1.0.12 • Published 6 months ago

match-conditions v1.0.12

Weekly downloads
55
License
MIT
Repository
github
Last release
6 months ago

match-conditions

Match a set of conditions for a collection of key-value pairs. Conditions are able to access nested keys.

Install

yarn add match-conditions

Usage

import { normalizeCondition, matchValuesWithCondition } from 'match-conditions'

// true
matchValuesWithCondition(
  normalizeCondition({
    a: '2'
  }),
  {
    a: '2'
  }
)

// false
matchValuesWithCondition(
  normalizeCondition({
    a: '3'
  }),
  {
    a: '2'
  }
)

// true
matchValuesWithCondition(
  normalizeCondition({
    any: {
      a: '3 | 2',
      b: 'c'
    }
  }),
  {
    a: '2',
    b: 'a'
  }
)
1.0.12

6 months ago

1.0.11

2 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago