Socket
Socket
Sign inDemoInstall

@emartech/data-aggregator-language

Package Overview
Dependencies
Maintainers
78
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emartech/data-aggregator-language - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

.idea/runConfigurations/All_Tests.xml

7

index.js

@@ -1,9 +0,8 @@

const chevrotain = require('chevrotain');
const aggregator = require('./src/aggregator');
const { tokens } = require('./src/lib/aggregator/tokens');
const { tokens } = require('./src/aggregator/tokens');
const tokenNames = require('./src/lib/token-names');
module.exports = {
aggregator,
tokens: tokens.map(currTok => chevrotain.tokenName(currTok))
tokens: tokenNames(tokens)
};

@@ -8,3 +8,3 @@ {

"test": "npm run test:style && npm run test:unit",
"test:unit": "mocha ./test/**/*.spec.js",
"test:unit": "mocha ./test/setup-tests.js ./**/*.spec.js",
"test:style": "eslint --fix --ext .js src test"

@@ -30,3 +30,3 @@ },

},
"version": "2.0.0"
"version": "2.1.0"
}

@@ -1,6 +0,6 @@

# Data Aggregator
# Data Aggregator Language
Execute aggregation expressions on a given data set.
# What it Does
## What it Does
Given the following input data structure,

@@ -27,3 +27,3 @@ ```js

* an aggregation expression mixed with arithmetic: `SUM reservations.silver + 3` would yield `(12 + 3) + 3 = 18`
# Usage
## Usage
```js

@@ -34,6 +34,6 @@ const aggregator = require('@emartech/data-aggregator-language')(input);

# Supported Syntax in Aggregation Expressions
## Supported Syntax in Aggregation Expressions
Examples below are for the `input` defined above.
## Constants
### Constants
* LENGTH

@@ -45,3 +45,3 @@ * `LENGTH` (yields 2)

## Unary Operators
### Unary Operators
* SUM

@@ -54,3 +54,3 @@ * `SUM reservations.silver` (yields 15)

## Binary Operators
### Binary Operators
+, -, *, /

@@ -60,6 +60,31 @@

# Commit Convention
## Using with Webpack
Because of the [way the underlying Chevrotain library is implemented](https://github.com/SAP/chevrotain/blob/master/examples/parser/minification/README.md), name mangling
interferes with the parser's operation. To resolve this issue, webpacked host projects need to disable name mangling for the token names used in this grammar.
To help with this, the module exports these names in a `tokens` array.
To configure webpack, include the following in your `webpack.config.js`:
```js
const { tokens } = require('@emartech/data-aggregator-language');
// other config
module.exports.optimization = {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
mangle: {
reserved: tokens
}
}
})
]
};
```
## Commit Convention
Semantic release depends on the [Angular commit message conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153). Please follow these.
# Credit
## Credit
Uses [SAP/chevrotain](https://github.com/SAP/chevrotain) for parsing.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc