object-search-key
Match the appropriate search keywords according to the key value definition of the object. Use yaml-joi as validator.
Install
$ npm install object-search-keyor$ yarn add object-search-key
Example
; const AccountModelDefine = `type: objectisSchema: truelimitation: - keys: id: type: number isSchema: true limitation: - min: 0 - max: 999999999 - integer: [] name: type: string isSchema: true limitation: - max: 32 age: type: number isSchema: true limitation: - min: 0 - integer: [] locked: type: string isSchema: true limitation: - only: [Y, N]`; const searchInput = '-123 hele xiaohuoni 24 1.2 N';const search = ;/** * Result: * { * id: [24], * name: ['-123', 'hele', 'xiaohuoni', '24', '1.2', 'N'], * age: [24], * locked: ['N'], * } */const or = Object; sequelizeAccount; /** * [ * { id: '123' }, * { id: '24' }, * { name: '123' }, * { name: 'hele' }, * { name: 'xiaohuoni' }, * { name: '24' }, * { name: '1.2' }, * { name: 'N' }, * { age: '123' }, * { age: '24' }, * { locked: 'N' }, * ] */
Get more at cases.yml.