Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wash

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wash - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

14

lib/builtins.js

@@ -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 @@

2

package.json
{
"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');

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