Comparing version 1.3.0 to 1.3.1
@@ -50,2 +50,8 @@ 'use strict'; | ||
Builtins.prototype.contains = function(x, elem) { | ||
console.assert(_.isString(x) || _.isArray(x)); | ||
return _.contains(x, elem); | ||
}; | ||
Builtins.prototype.sort = function(x) { | ||
@@ -130,5 +136,5 @@ console.assert(_.isString(x) || _.isArray(x)); | ||
Builtins.prototype.timestamp = function(s) { | ||
console.assert(_.isString(s)); | ||
console.assert(_.isUndefined(s) || _.isString(s)); | ||
var ts = Date.parse(s); | ||
var ts = s ? Date.parse(s) : Date.now(); | ||
console.assert(!_.isNaN(ts)); | ||
@@ -139,2 +145,6 @@ | ||
Builtins.prototype.array = function() { | ||
return Array.prototype.slice.call(arguments); | ||
}; | ||
Builtins.prototype.math = Math; | ||
@@ -141,0 +151,0 @@ |
{ | ||
"name": "wash", | ||
"description": "a safe template rendering engine", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"main": "index", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -136,8 +136,25 @@ 'use strict'; | ||
expectRuntimeError('{{ timestamp() }}', ''); | ||
expectRuntimeError('{{ timestamp(123) }}', ''); | ||
expectRuntimeError('{{ timestamp("") }}', ''); | ||
expectRuntimeError('{{ timestamp("not a time") }}', ''); | ||
}); | ||
describe('contains', function() { | ||
expect('{{ contains(arr, 0) }}', 'true'); | ||
expect('{{ contains(arr, 1000) }}', 'false'); | ||
expect('{{ contains("abc", "b") }}', 'true'); | ||
expect('{{ contains("abc", "bc") }}', 'true'); | ||
expect('{{ contains("abc", "abc") }}', 'true'); | ||
expect('{{ contains("abc", "d") }}', 'false'); | ||
expect('{{ contains("abc", "abcd") }}', 'false'); | ||
}); | ||
describe('array', function() { | ||
expect('{{ array() }}', ''); // javascript default array string rep | ||
expect('{{ array(1) }}', '1'); // javascript default array string rep | ||
expect('{{ array(1,2,3) }}', '1,2,3'); // javascript default array string rep | ||
expect('{{ str(array()) }}', '[]'); // JSON array string rep | ||
expect('{{ str(array(1)) }}', '[1]'); // JSON array string rep | ||
expect('{{ str(array(1,2,3)) }}', '[1,2,3]'); // JSON array string rep | ||
}); | ||
describe('math', function() { | ||
@@ -144,0 +161,0 @@ expect('{{ math.min(4, 5) }}', '4'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61464
1335