mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-30 18:12:25 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			617 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			617 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function stringifySequelizeQuery(findOptions) {
 | |
|   function isClass(func) {
 | |
|     return typeof func === 'function' && /^class\s/.test(func.toString())
 | |
|   }
 | |
| 
 | |
|   function replacer(key, value) {
 | |
|     if (typeof value === 'object' && value !== null) {
 | |
|       const symbols = Object.getOwnPropertySymbols(value).reduce((acc, sym) => {
 | |
|         acc[sym.toString()] = value[sym]
 | |
|         return acc
 | |
|       }, {})
 | |
| 
 | |
|       return { ...value, ...symbols }
 | |
|     }
 | |
| 
 | |
|     if (isClass(value)) {
 | |
|       return `${value.name}`
 | |
|     }
 | |
| 
 | |
|     return value
 | |
|   }
 | |
| 
 | |
|   return JSON.stringify(findOptions, replacer)
 | |
| }
 | |
| module.exports = stringifySequelizeQuery
 |