Skip to content

Commit

Permalink
feat: make maxNestingLevel configurable
Browse files Browse the repository at this point in the history
BREAKING CHANGE: now requires node 6.2 (default arguments)
  • Loading branch information
arlac77 committed Jun 27, 2016
1 parent 720fd5a commit e6fb6a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 4.2
- 6.2
sudo: false
branches:
only:
Expand Down
11 changes: 4 additions & 7 deletions lib/expander.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ function _quote(str, expression) {
* the default evaluation function simply does a lookup into the properties
* - keepUndefinedValues
* true: is expression resolved to undefind the original string will be used (with surrounding ${})
* - maxNestingLevel max number of recursive calls to expand defaults to 5
*
* @return {ExpressionExpander} newly created expansion context
*/
exports.createContext = function (options) {

if (options === undefined) {
options = {};
}
exports.createContext = function (options = {}) {

const keepUndefinedValues = options.keepUndefinedValues === undefined ?
false : options.keepUndefinedValues ? true : false;

const valueQuoter = options.valueQuoter || _quote;
const maxNestingLevel = 5;
const maxNestingLevel = options.maxNestingLevel || 5;

let properties = {};

Expand All @@ -52,7 +49,7 @@ exports.createContext = function (options) {
}
}, {
/**
* Properties used for the default expander implemenetation
* Properties used for the default expander implementation
*/
properties: {
get: function () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/arlac77/expression-expander.git"
},
"engines": {
"node": ">=4.2.1"
"node": ">=6.2"
},
"keywords": [
"expression",
Expand Down

0 comments on commit e6fb6a2

Please sign in to comment.