Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
excel-formula-ast
Advanced tools
Changelog
[1.1.1] - 2017-09-08
Readme
Abstract syntax tree for excel formulas.
npm install excel-formula-ast -S
or
yarn add excel-formula-ast
const {tokenize} = require('excel-formula-tokenizer');
const {buildTree, visit} = require('excel-formula-ast');
const formula = 'SUM(1, 2)';
const tokens = tokenize(formula);
// build tree
const tree = buildTree(tokens);
// create visitor for parts of tree you're interested in
const visitor = {
enterFunction(functionNode) {
console.log(`function is ${functionNode.name}`);
},
enterNumber(numberNode) {
console.log(`number is ${numberNode.value}`)
}
};
// send visitor through tree
visit(tree, visitor);
// prints:
// function is SUM
// number is 1
// number is 2
const {buildTree, visit} = require('excel-formula-ast');
Build expression tree from tokens.
Returns: ast node
Send a visitor through the tree nodes.
Visitor is an object with any of these function properties:
{
enterCell(node) {},
exitCell(node) {},
enterCellRange(node) {},
exitCellRange(node) {},
enterFunction(node) {},
exitFunction(node) {},
enterNumber(node) {},
exitNumber(node) {},
enterText(node) {},
exitText(node) {},
enterLogical(node) {},
exitLogical(node) {},
enterBinaryExpression(node) {},
exitBinaryExpression(node) {},
enterUnaryExpression(node) {},
exitUnaryExpression(node) {}
}
For any node type Foo
enterFoo()
is called when the visitor gets to a Foo node.exitFoo()
is called when the visitor has visited all of the Foo's child nodes (if any) and is leaving the Foo.Passed to visitor methods: enterCell
, exitCell
Properties:
'cell'
'A1'
'relative' | 'mixed' | 'absolute'
Passed to visitor methods: enterCellRange
, exitCellRange
Properties:
'cell-range'
Passed to visitor methods: enterFunction
, exitFunction
Properties:
'function'
Passed to visitor methods: enterNumber
, exitNumber
Properties:
'number'
Passed to visitor methods: enterText
, exitText
Properties:
'text'
Passed to visitor methods enterLogical
, exitLogical
Properties:
'logical'
Passed to visitor methods: enterBinaryExpression
, exitBinaryExpression
Properties:
binary-expression
Passed to visitor methods: enterUnaryExpression
, exitUnaryExpression
Properties:
'unary-expression'
MIT
FAQs
Abstract syntax tree for excel formulas
The npm package excel-formula-ast receives a total of 3,470 weekly downloads. As such, excel-formula-ast popularity was classified as popular.
We found that excel-formula-ast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.