Comparing version 2.0.3 to 2.1.0
{ | ||
"name": "varson", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -22,12 +22,12 @@ "main": "index.js", | ||
"dependencies": { | ||
"aug": "^2.0.0", | ||
"aug": "^3.0.1", | ||
"lodash.get": "^4.4.2" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.9.0", | ||
"eslint-config-firstandthird": "^4.0.1", | ||
"eslint-plugin-import": "^2.1.0", | ||
"ms": "^2.0.0", | ||
"tap": "^10.7.2" | ||
"eslint": "^5.16.0", | ||
"eslint-config-firstandthird": "^4.3.0", | ||
"eslint-plugin-import": "^2.17.2", | ||
"ms": "^2.1.1", | ||
"tap": "^13.1.2" | ||
} | ||
} |
@@ -1,2 +0,4 @@ | ||
const test = require('tap').test; | ||
const tap = require('tap'); | ||
const test = tap.test; | ||
const skip = function() {}; | ||
const varson = require('../'); | ||
@@ -50,2 +52,14 @@ | ||
test('should keep the if boolean false', (t) => { | ||
t.plan(1); | ||
const result = varson({ | ||
first: '', | ||
hasFirst: '{{ first ? true : false}}' | ||
}); | ||
t.deepEqual(result, { | ||
first: '', | ||
hasFirst: false | ||
}); | ||
}); | ||
test('should keep the if number', (t) => { | ||
@@ -640,2 +654,57 @@ t.plan(1); | ||
test('variables in method arguments', (t) => { | ||
t.plan(1); | ||
const add = function(a, b) { | ||
return a + b; | ||
}; | ||
const result = varson({ | ||
a: 1, | ||
b: 2, | ||
equals: '{{add(a, b)}}' | ||
}, { | ||
add | ||
}); | ||
t.deepEqual(result, { | ||
a: 1, | ||
b: 2, | ||
equals: 3 | ||
}); | ||
}); | ||
test('function with complex args', (t) => { | ||
t.plan(1); | ||
const echo = function(a) { | ||
return a; | ||
}; | ||
const result = varson({ | ||
first: 'bob', | ||
equals: '{{echo("my name is " + first)}}' | ||
}, { | ||
echo | ||
}); | ||
t.deepEqual(result, { | ||
first: 'bob', | ||
equals: 'my name is bob' | ||
}); | ||
}); | ||
test('support backticks', (t) => { | ||
t.plan(1); | ||
const join = function(a, b) { | ||
return a + b; | ||
}; | ||
const result = varson({ | ||
first: 'bob', | ||
last: 'smith', | ||
equals: '{{join(`my name is ${first} `, last)}}' | ||
}, { | ||
join | ||
}); | ||
t.deepEqual(result, { | ||
first: 'bob', | ||
last: 'smith', | ||
equals: 'my name is bob smith' | ||
}); | ||
}); | ||
test('promises', (t) => { | ||
@@ -642,0 +711,0 @@ const results = varson({ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15819
768
+ Addedaug@3.1.1(transitive)
- Removedaug@2.0.1(transitive)
Updatedaug@^3.0.1