Skip to content

Commit

Permalink
Bump version for 2.4.2 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Apr 15, 2016
1 parent d30a677 commit 7faaf2c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 23 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Changelog
=========


2.x (unreleased)
----------------
2.4.2 (Apr 15 2016)
-------------------

* Fix use of `in` operator with strings. Fixes
[#714](https://github.com/mozilla/nunjucks/issues/714). Thanks Zubrik for the
Expand Down
26 changes: 19 additions & 7 deletions browser/nunjucks-slim.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Browser bundle of nunjucks 2.4.1 (slim, only works with precompiled templates) */
/*! Browser bundle of nunjucks 2.4.2 (slim, only works with precompiled templates) */
var nunjucks =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
Expand Down Expand Up @@ -425,11 +425,13 @@ var nunjucks =
}
};

exports.inOperator = function (key, arrOrObj) {
if (exports.isArray(arrOrObj)) {
return exports.indexOf(arrOrObj, key) !== -1;
} else if (exports.isObject(arrOrObj)) {
return key in arrOrObj;
exports.inOperator = function (key, val) {
if (exports.isArray(val)) {
return exports.indexOf(val, key) !== -1;
} else if (exports.isObject(val)) {
return key in val;
} else if (exports.isString(val)) {
return val.indexOf(key) !== -1;
} else {
throw new Error('Cannot use "in" operator to search for "'
+ key + '" in unexpected types.');
Expand Down Expand Up @@ -1588,7 +1590,17 @@ var nunjucks =
length: function(val) {
var value = normalize(val, '');

return value !== undefined ? value.length : 0;
if(value !== undefined) {
if(
(typeof Map === 'function' && value instanceof Map) ||
(typeof Set === 'function' && value instanceof Set)
) {
// ECMAScript 2015 Maps and Sets
return value.size;
}
return value.length;
}
return 0;
},

list: function(val) {
Expand Down
4 changes: 2 additions & 2 deletions browser/nunjucks-slim.min.js

Large diffs are not rendered by default.

28 changes: 20 additions & 8 deletions browser/nunjucks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Browser bundle of nunjucks 2.4.1 */
/*! Browser bundle of nunjucks 2.4.2 */
var nunjucks =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
Expand Down Expand Up @@ -425,11 +425,13 @@ var nunjucks =
}
};

exports.inOperator = function (key, arrOrObj) {
if (exports.isArray(arrOrObj)) {
return exports.indexOf(arrOrObj, key) !== -1;
} else if (exports.isObject(arrOrObj)) {
return key in arrOrObj;
exports.inOperator = function (key, val) {
if (exports.isArray(val)) {
return exports.indexOf(val, key) !== -1;
} else if (exports.isObject(val)) {
return key in val;
} else if (exports.isString(val)) {
return val.indexOf(key) !== -1;
} else {
throw new Error('Cannot use "in" operator to search for "'
+ key + '" in unexpected types.');
Expand Down Expand Up @@ -1854,7 +1856,7 @@ var nunjucks =
return this._getNodeName(node.target) + '["' +
this._getNodeName(node.val) + '"]';
case 'Literal':
return node.value.toString().substr(0, 10);
return node.value.toString();
default:
return '--expression--';
}
Expand Down Expand Up @@ -5506,7 +5508,17 @@ var nunjucks =
length: function(val) {
var value = normalize(val, '');

return value !== undefined ? value.length : 0;
if(value !== undefined) {
if(
(typeof Map === 'function' && value instanceof Map) ||
(typeof Set === 'function' && value instanceof Set)
) {
// ECMAScript 2015 Maps and Sets
return value.size;
}
return value.length;
}
return 0;
},

list: function(val) {
Expand Down
6 changes: 3 additions & 3 deletions browser/nunjucks.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nunjucks",
"description": "A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)",
"version": "2.5.0-dev.2",
"version": "2.4.2",
"author": "James Long <longster@gmail.com>",
"dependencies": {
"asap": "^2.0.3",
Expand Down

0 comments on commit 7faaf2c

Please sign in to comment.