Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,16 @@ | ||
<a name="1.0.2"></a> | ||
## [1.0.2](https://github.com/poppinss/edge/compare/v1.0.1...v1.0.2) (2017-08-08) | ||
### Bug Fixes | ||
* **context:** bind context to global functions ([e0a2685](https://github.com/poppinss/edge/commit/e0a2685)) | ||
### Features | ||
* **globals:** add elIf ([fb522ce](https://github.com/poppinss/edge/commit/fb522ce)) | ||
<a name="1.0.1"></a> | ||
@@ -2,0 +17,0 @@ ## [1.0.1](https://github.com/poppinss/edge/compare/v1.0.0...v1.0.1) (2017-06-21) |
{ | ||
"name": "edge.js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Node.js logical templating engine with fresh air", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -155,2 +155,3 @@ 'use strict' | ||
value = _.get(this.$globals, key) | ||
value = typeof (value) === 'function' ? value.bind(this) : value | ||
} | ||
@@ -157,0 +158,0 @@ |
@@ -143,3 +143,3 @@ 'use strict' | ||
return this.safe(htmlStr.replace(/\$([\w.-]+)/g, (match, group) => { | ||
return _.get(hash, _.toPath(group)) | ||
return group === 'self' ? hash : _.get(hash, _.toPath(group)) | ||
})) | ||
@@ -149,2 +149,24 @@ } | ||
/** | ||
* Return element only when the 3rd param | ||
* is true. | ||
* | ||
* @method elIf | ||
* | ||
* @param {String} htmlStr | ||
* @param {Object} hash | ||
* @param {Boolean} ifResult | ||
* | ||
* @return {String} | ||
*/ | ||
const elIf = function (htmlStr, hash, ifResult) { | ||
if (!ifResult) { | ||
return '' | ||
} | ||
return this.safe(htmlStr.replace(/\$([\w.-]+)/g, (match, group) => { | ||
return group === 'self' ? hash : _.get(hash, _.toPath(group)) | ||
})) | ||
} | ||
/** | ||
* Convert a string to camelcase | ||
@@ -281,2 +303,3 @@ * | ||
el, | ||
elIf, | ||
camelCase, | ||
@@ -283,0 +306,0 @@ upperCase, |
Sorry, the diff of this file is not supported yet
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
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
520341
5492
2