Skip to content

Commit

Permalink
New operators (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr authored Mar 21, 2022
1 parent 6375f0d commit 0de092c
Show file tree
Hide file tree
Showing 12 changed files with 5,078 additions and 1,105 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: CI

on:
push:
branches:
- master
release:
types: [ published ]
pull_request:
branches:
- '**'

env:
PRIMARY_NODE_VERSION: 16.x
PRIMARY_OS: ubuntu-latest
REGISTRY: https://registry.npmjs.org/

jobs:
test:
name: CI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
node-version: [ 6.x, 8.x, 10.x, 12.x, 14.x, 16.x ]

steps:

- name: Echo env variables
run: |
echo ref: ${{ github.event.client_payload.ref || github.ref }}
echo sha: ${{ github.event.client_payload.sha || github.sha }}
echo head ref: ${{ github.event.client_payload.head_ref || github.head_ref }}
echo base ref: ${{ github.event.client_payload.base_ref || github.base_ref }}
echo action: ${{ github.action }}
echo event: ${{ github.event_name }}
- uses: actions/checkout@v2
name: Checkout
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.node-version }}-node
restore-keys: |
${{ matrix.os }}-${{ matrix.node-version }}-node
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Snyk security check
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Run types tests
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
run: |
npm run test:tsd
- name: Run unit tests with coverage
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
uses: paambaati/codeclimate-action@v2.7.5
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: npm run test:cover

- name: Run unit tests
if: "!(matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS)"
run: npm run test:unit

publish_version:
name: Publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 6.x ]
needs: [ test ]
if: github.event_name == 'release' && github.event.action == 'published'
steps:

- name: Checkout
uses: actions/checkout@v2

- name: fetch
run: |
git fetch --prune --unshallow
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: ${{ env.REGISTRY }}

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.node-version }}-node
restore-keys: |
${{ matrix.os }}-${{ matrix.node-version }}-node
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
registry: ${{ env.REGISTRY }}
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Npm Version](https://img.shields.io/npm/v/json-expression-eval.svg?style=popout)](https://www.npmjs.com/package/json-expression-eval)
![node](https://img.shields.io/node/v-lts/json-expression-eval)
[![Build Status](https://travis-ci.org/regevbr/json-expression-eval.svg?branch=master)](https://travis-ci.org/regevbr/json-expression-eval)
[![Build Status](https://github.com/regevbr/json-expression-eval/actions/workflows/ci.yml/badge.svg?branch=master)]
[![Test Coverage](https://api.codeclimate.com/v1/badges/5cc9e9fe4871a315f2aa/test_coverage)](https://codeclimate.com/github/regevbr/json-expression-eval/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/5cc9e9fe4871a315f2aa/maintainability)](https://codeclimate.com/github/regevbr/json-expression-eval/maintainability)
[![Known Vulnerabilities](https://snyk.io/test/github/regevbr/json-expression-eval/badge.svg?targetFile=package.json)](https://snyk.io/test/github/regevbr/json-expression-eval?targetFile=package.json)
Expand Down Expand Up @@ -130,6 +130,11 @@ There are 4 types of operators you can use (evaluated in that order of precedenc
- `lte` - <=
- `eq` - ===
- `neq` - !==
- `regexp: RegExp` - True if matches the compiled regular expression.
- `regexpi: RegExp` - True if matches the compiled regular expression with the `i` flag set.
- `nin: any[]` - True if *not* in an array of values. Comparison is done using the `===` operator
- `inq: any[]` - True if in an array of values. Comparison is done using the `===` operator
- `between: readonly [number, number] (as const)` - True if the value is between the two specified values: greater than or equal to first value and less than or equal to second value.
- `{property: value}`
- compares the property to that value (shorthand to the `eq` op)
> Nested properties in the context can also be accessed using a dot notation (see example above)
Expand Down
Loading

0 comments on commit 0de092c

Please sign in to comment.