Installations
npm install pip-services3-expressions-nodex
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=14.0.0
Node Version
18.15.0
NPM Version
9.5.0
Score
78.3
Supply Chain
98.7
Quality
77.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (97.97%)
PowerShell (2.03%)
Developer
pip-services3-nodex
Download Statistics
Total Downloads
34,626
Last Day
4
Last Week
248
Last Month
1,554
Last Year
14,319
GitHub Statistics
15 Commits
1 Forks
3 Watching
1 Branches
3 Contributors
Bundle Size
209.22 kB
Minified
39.02 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.4
Package Id
pip-services3-expressions-nodex@1.0.4
Unpacked Size
832.23 kB
Size
118.44 kB
File Count
392
NPM Version
9.5.0
Node Version
18.15.0
Publised On
03 Apr 2023
Total Downloads
Cumulative downloads
Total Downloads
34,626
Last day
-50%
4
Compared to previous day
Last week
23.4%
248
Compared to previous week
Last month
-74.8%
1,554
Compared to previous month
Last year
30%
14,319
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
5
Tokenizers, parsers and expression calculators in Node.js / ES2017
This module is a part of the Pip.Services polyglot microservices toolkit. It provides syntax and lexical analyzers and expression calculator optimized for repeated calculations.
The module contains the following packages:
- Calculator - Expression calculator
- CSV - CSV tokenizer
- IO - input/output utility classes to support lexical analysis
- Mustache - Mustache templating engine
- Tokenizers - lexical analyzers to break incoming character streams into tokens
- Variants - dynamic objects that can hold any values and operators for them
Use
Install the NPM package as
1npm install pip-services3-expressions-nodex --save
The example below shows how to use expression calculator to dynamically calculate user-defined expressions.
1import { IConfigurable } from 'pip-services3-commons-nodex'; 2import { ConfigParams } from 'pip-services3-commons-nodex'; 3import { IReferenceable } from 'pip-services3-commons-nodex'; 4import { IReferences } from 'pip-services3-commons-nodex'; 5import { Descriptor } from 'pip-services3-commons-nodex'; 6import { IOpenable } from 'pip-services3-commons-nodex'; 7 8... 9let calculator = new ExpressionCalculator(); 10 11calculator.expression = "A + b / (3 - Max(-123, 1)*2)"; 12 13let vars = new VariableCollection(); 14vars.add(new Variable("A", new Variant(1))); 15vars.add(new Variable("B", new Variant("3"))); 16 17let result = await calculator.evaluateWithVariables(vars); 18console.log("The result of the expression is " + result.asString); 19...
This is an example to process mustache templates.
1let mustache = new MustacheTemplate(); 2mustache.template = "Hello, {{{NAME}}}{{#ESCLAMATION}}!{{/ESCLAMATION}}{{#unless ESCLAMATION}}.{{/unless}}"; 3let result = mustache.evaluateWithVariables({ NAME: 'Mike', ESCLAMATION: true }); 4console.log("The result of template evaluation is '" + result + "'");
Develop
For development you shall install the following prerequisites:
- Node.js 8+
- Visual Studio Code or another IDE of your choice
- Docker
- Typescript
Install dependencies:
1npm install
Compile the code:
1tsc
Run automated tests:
1npm test
Generate API documentation:
1./docgen.ps1
Before committing changes run dockerized build and test as:
1./build.ps1 2./test.ps1 3./clear.ps1
Contacts
The module is created and maintained by Sergey Seroukhov.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/github-ci.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/pip-services3-nodex/pip-services3-expressions-nodex/github-ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/pip-services3-nodex/pip-services3-expressions-nodex/github-ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/pip-services3-nodex/pip-services3-expressions-nodex/github-ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/pip-services3-nodex/pip-services3-expressions-nodex/github-ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yml:98: update your workflow using https://app.stepsecurity.io/secureworkflow/pip-services3-nodex/pip-services3-expressions-nodex/github-ci.yml/main?enable=pin
- Warn: containerImage not pinned by hash: docker/Dockerfile.build:1: pin your Docker image by updating node:14 to node:14@sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f6fd8461aa
- Warn: containerImage not pinned by hash: docker/Dockerfile.docs:1: pin your Docker image by updating node:14-alpine to node:14-alpine@sha256:434215b487a329c9e867202ff89e704d3a75e554822e07f3e0c0f9e606121b33
- Warn: containerImage not pinned by hash: docker/Dockerfile.test:1: pin your Docker image by updating node:14 to node:14@sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f6fd8461aa
- Warn: npmCommand not pinned by hash: docker/Dockerfile.build:4
- Warn: npmCommand not pinned by hash: docker/Dockerfile.build:12
- Warn: pipCommand not pinned by hash: docker/Dockerfile.docs:11-13
- Warn: npmCommand not pinned by hash: docker/Dockerfile.docs:22-27
- Warn: npmCommand not pinned by hash: docker/Dockerfile.docs:22-27
- Warn: npmCommand not pinned by hash: docker/Dockerfile.docs:22-27
- Warn: npmCommand not pinned by hash: docker/Dockerfile.docs:22-27
- Warn: npmCommand not pinned by hash: docker/Dockerfile.docs:22-27
- Warn: npmCommand not pinned by hash: docker/Dockerfile.docs:22-27
- Warn: npmCommand not pinned by hash: docker/Dockerfile.test:9
- Info: 0 out of 5 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 3 containerImage dependencies pinned
- Info: 0 out of 9 npmCommand dependencies pinned
- Info: 0 out of 1 pipCommand dependencies pinned
Score
3.4
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More