Skip to content

Commit

Permalink
Release v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Kinast committed Nov 4, 2014
1 parent 5749311 commit 9ebfc6f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
Binary file added archive/dustjs-helpers-1.4.0.tar.gz
Binary file not shown.
Binary file added archive/dustjs-helpers-1.4.0.zip
Binary file not shown.
47 changes: 26 additions & 21 deletions dist/dust-helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dustjs-helpers - v1.3.0
/*! dustjs-helpers - v1.4.0
* https://github.com/linkedin/dustjs-helpers
* Copyright (c) 2014 Aleksander Williams; Released under the MIT License */
(function(dust){
Expand Down Expand Up @@ -97,16 +97,16 @@ var helpers = {
Reference resolution rules:
if value exists in JSON:
"" or '' will evaluate to false, boolean false, null, or undefined will evaluate to false,
numeric 0 evaluates to true, so does, string "0", string "null", string "undefined" and string "false".
numeric 0 evaluates to true, so does, string "0", string "null", string "undefined" and string "false".
Also note that empty array -> [] is evaluated to false and empty object -> {} and non-empty object are evaluated to true
The type of the return value is string ( since we concatenate to support interpolated references
The type of the return value is string ( since we concatenate to support interpolated references
if value does not exist in JSON and the input is a single reference: {x}
dust render emits empty string, and we then return false
dust render emits empty string, and we then return false
if values does not exist in JSON and the input is interpolated references : {x} < {y}
dust render emits < and we return the partial output
dust render emits < and we return the partial output
*/
"tap": function(input, chunk, context) {
// return given input if there is no dust reference to resolve
Expand Down Expand Up @@ -186,6 +186,9 @@ var helpers = {
return chunk;
}
else {
// encode opening brackets when outputting to html
dump = dump.replace(/</g, '\\u003c');

return chunk.write(dump);
}
},
Expand Down Expand Up @@ -359,8 +362,9 @@ var helpers = {
"eq": function(chunk, context, bodies, params) {
if(params) {
params.filterOpType = "eq";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual === expected; });
}
return filter(chunk, context, bodies, params, function(expected, actual) { return actual === expected; });
return chunk;
},

/**
Expand All @@ -379,7 +383,7 @@ var helpers = {
params.filterOpType = "ne";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual !== expected; });
}
return chunk;
return chunk;
},

/**
Expand All @@ -394,10 +398,11 @@ var helpers = {
Note : use type="number" when comparing numeric
**/
"lt": function(chunk, context, bodies, params) {
if(params) {
params.filterOpType = "lt";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual < expected; });
}
if(params) {
params.filterOpType = "lt";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual < expected; });
}
return chunk;
},

/**
Expand All @@ -412,10 +417,10 @@ var helpers = {
Note : use type="number" when comparing numeric
**/
"lte": function(chunk, context, bodies, params) {
if(params) {
params.filterOpType = "lte";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual <= expected; });
}
if(params) {
params.filterOpType = "lte";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual <= expected; });
}
return chunk;
},

Expand Down Expand Up @@ -456,7 +461,7 @@ var helpers = {
params.filterOpType = "gte";
return filter(chunk, context, bodies, params, function(expected, actual) { return actual >= expected; });
}
return chunk;
return chunk;
},

// to be used in conjunction with the select helper
Expand Down Expand Up @@ -502,8 +507,8 @@ var helpers = {
}
return chunk.write(value);
}


};

for (var key in helpers) {
Expand All @@ -514,4 +519,4 @@ var helpers = {
module.exports = dust;
}

})(typeof exports !== 'undefined' ? require('dustjs-linkedin') : dust);
})(typeof exports !== 'undefined' ? require('dustjs-linkedin') : dust);
4 changes: 2 additions & 2 deletions dist/dust-helpers.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ebfc6f

Please sign in to comment.