xen-orchestra/packages/complex-matcher
2023-07-28 10:05:26 +02:00
..
.npmignore feat: unified .npmignore for all packages 2021-04-07 13:58:14 +02:00
.USAGE.md chore: hide USAGE.md 2022-02-18 17:11:52 +01:00
index.bench.js chore(complex-matcher): remove build step 2022-06-22 09:55:59 +02:00
index.fixtures.js chore(complex-matcher): remove build step 2022-06-22 09:55:59 +02:00
index.js fix(complex-matcher): import specific lodash functions (#6904) 2023-07-10 16:01:54 +02:00
index.test.js chore: format with Prettier 2022-11-22 17:30:14 +01:00
package.json feat: technical release (#6956) 2023-07-28 10:05:26 +02:00
README.md docs: uniformize code blocks 2023-02-06 11:25:12 +01:00

complex-matcher

Package Version License PackagePhobia Node compatibility

Advanced search syntax used in XO

Install

Installation of the npm package:

npm install --save complex-matcher

Usage

import * as CM from 'complex-matcher'

const characters = [
  { name: 'Catwoman', costumeColor: 'black' },
  { name: 'Superman', costumeColor: 'blue', hasCape: true },
  { name: 'Wonder Woman', costumeColor: 'blue' },
]

const predicate = CM.parse('costumeColor:blue hasCape?').createPredicate()

characters.filter(predicate)
// [
//   { name: 'Superman', costumeColor: 'blue', hasCape: true },
// ]

new CM.String('foo').createPredicate()

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Vates SAS