
Security News
NIST Officially Stops Enriching Most CVEs as Vulnerability Volume Skyrockets
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.
object-search-key
Advanced tools
Match the appropriate search keywords according to the key value definition of the object
Match the appropriate search keywords according to the key value definition of the object. Use yaml-joi as validator.
$ npm install object-search-key
or
$ yarn add object-search-key
import { getObjectSearchKeys } from 'object-search-key';
const AccountModelDefine = `
type: object
isSchema: true
limitation:
- 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'.split(/(?:\s*)/);
const search = getObjectSearchKeys(AccountModelDefine, searchInput);
/**
* Result:
* {
* id: [24],
* name: ['-123', 'hele', 'xiaohuoni', '24', '1.2', 'N'],
* age: [24],
* locked: ['N'],
* }
*/
const or = Object.entries(search).reduce((prev, [key, value]) => {
return prev.concat(value.map(searchKey => ({ [key]: searchKey })));
}, []);
sequelize.Account.findAndCountAll({ where: { [Op.or]: or } });
/**
* [
* { 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.
FAQs
Match the appropriate search keywords according to the key value definition of the object
The npm package object-search-key receives a total of 6 weekly downloads. As such, object-search-key popularity was classified as not popular.
We found that object-search-key demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.