@pluginjs/template
Advanced tools
Comparing version 0.7.2 to 0.7.3
/*! | ||
* @pluginjs/template v0.7.2 (https://pluginjs.com) | ||
* @pluginjs/template v0.7.3 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
@@ -14,3 +14,7 @@ * Released under the GPL-3.0 License. | ||
function render(string, ...args) { | ||
function render(string) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
if (args.length === 1 && typeof args[0] === 'object') { | ||
@@ -49,3 +53,7 @@ args = args[0]; | ||
compile(str) { | ||
return function (...args) { | ||
return function () { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return render(str, ...args); | ||
@@ -52,0 +60,0 @@ }; |
/*! | ||
* @pluginjs/template v0.7.2 (https://pluginjs.com) | ||
* @pluginjs/template v0.7.3 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
*/ | ||
"use strict";var utils=require("@pluginjs/utils");const pattern=/\{\s*([.0-9a-zA-Z_]+)\s*\}/g;function render(t,...e){return 1===e.length&&"object"==typeof e[0]&&(e=e[0]),e&&e.hasOwnProperty||(e={}),t.replace(pattern,(r,n,l)=>{let u=null;return"{"===t[l-1]&&"}"===t[l+r.length]?n:(Object.prototype.hasOwnProperty.call(e,n)?u=e[n]:-1!==n.indexOf(".")&&(u=utils.getValueByPath(e,n)),null==u?"":u)})}var main={render:render,compile:t=>(function(...e){return render(t,...e)}),parse(t){const e=t.match(pattern);if(null===e)return!1;const r=[];for(let t=0;t<e.length;t++)e[t].match(/^\{\{.+\}\}$/g)||r.push(e[t].substring(1,e[t].length-1).trim());return r}};module.exports=main; | ||
"use strict";var utils=require("@pluginjs/utils");const pattern=/\{\s*([.0-9a-zA-Z_]+)\s*\}/g;function render(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return 1===t.length&&"object"==typeof t[0]&&(t=t[0]),t&&t.hasOwnProperty||(t={}),r.replace(pattern,(e,n,l)=>{let a=null;return"{"===r[l-1]&&"}"===r[l+e.length]?n:(Object.prototype.hasOwnProperty.call(t,n)?a=t[n]:-1!==n.indexOf(".")&&(a=utils.getValueByPath(t,n)),null==a?"":a)})}var main={render:render,compile:r=>(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return render(r,...t)}),parse(r){const e=r.match(pattern);if(null===e)return!1;const t=[];for(let r=0;r<e.length;r++)e[r].match(/^\{\{.+\}\}$/g)||t.push(e[r].substring(1,e[r].length-1).trim());return t}};module.exports=main; |
/*! | ||
* @pluginjs/template v0.7.2 (https://pluginjs.com) | ||
* @pluginjs/template v0.7.3 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
@@ -12,3 +12,7 @@ * Released under the GPL-3.0 License. | ||
function render(string, ...args) { | ||
function render(string) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
if (args.length === 1 && typeof args[0] === 'object') { | ||
@@ -47,3 +51,7 @@ args = args[0]; | ||
compile(str) { | ||
return function (...args) { | ||
return function () { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return render(str, ...args); | ||
@@ -50,0 +58,0 @@ }; |
/*! | ||
* @pluginjs/template v0.7.2 (https://pluginjs.com) | ||
* @pluginjs/template v0.7.3 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
*/ | ||
import{getValueByPath}from"@pluginjs/utils";const pattern=/\{\s*([.0-9a-zA-Z_]+)\s*\}/g;function render(t,...e){return 1===e.length&&"object"==typeof e[0]&&(e=e[0]),e&&e.hasOwnProperty||(e={}),t.replace(pattern,(r,n,l)=>{let a=null;return"{"===t[l-1]&&"}"===t[l+r.length]?n:(Object.prototype.hasOwnProperty.call(e,n)?a=e[n]:-1!==n.indexOf(".")&&(a=getValueByPath(e,n)),null==a?"":a)})}var main={render:render,compile:t=>(function(...e){return render(t,...e)}),parse(t){const e=t.match(pattern);if(null===e)return!1;const r=[];for(let t=0;t<e.length;t++)e[t].match(/^\{\{.+\}\}$/g)||r.push(e[t].substring(1,e[t].length-1).trim());return r}};export default main; | ||
import{getValueByPath}from"@pluginjs/utils";const pattern=/\{\s*([.0-9a-zA-Z_]+)\s*\}/g;function render(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return 1===t.length&&"object"==typeof t[0]&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(pattern,(r,n,a)=>{let l=null;return"{"===e[a-1]&&"}"===e[a+r.length]?n:(Object.prototype.hasOwnProperty.call(t,n)?l=t[n]:-1!==n.indexOf(".")&&(l=getValueByPath(t,n)),null==l?"":l)})}var main={render:render,compile:e=>(function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return render(e,...t)}),parse(e){const r=e.match(pattern);if(null===r)return!1;const t=[];for(let e=0;e<r.length;e++)r[e].match(/^\{\{.+\}\}$/g)||t.push(r[e].substring(1,r[e].length-1).trim());return t}};export default main; |
/*! | ||
* @pluginjs/template v0.7.2 (https://pluginjs.com) | ||
* @pluginjs/template v0.7.3 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
/*! | ||
* @pluginjs/template v0.7.2 (https://pluginjs.com) | ||
* @pluginjs/template v0.7.3 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"category": "core", | ||
@@ -37,3 +37,3 @@ "main": "dist/template.common.js", | ||
"dependencies": { | ||
"@pluginjs/utils": "^0.7.2" | ||
"@pluginjs/utils": "^0.7.3" | ||
}, | ||
@@ -43,3 +43,3 @@ "devDependencies": { | ||
"@pluginjs/browserslist-config": "^1.2.2", | ||
"@pluginjs/cli": "^0.7.2", | ||
"@pluginjs/cli": "^0.7.3", | ||
"babel-jest": "*", | ||
@@ -71,3 +71,3 @@ "jest": "*", | ||
"title": "Plugin", | ||
"gitHead": "f18c85114d702b75d2d67e57e43b51100f161f31" | ||
"gitHead": "304f657f71c8be62068380bd34fdc7f003082a24" | ||
} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
17626
10
341
4
Updated@pluginjs/utils@^0.7.3