@pluginjs/template
Advanced tools
Comparing version 0.7.4 to 0.7.5
/*! | ||
* @pluginjs/template v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/template v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* @pluginjs/template v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/template v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 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(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.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/template v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* @pluginjs/template v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/template v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 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(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.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/template v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* @pluginjs/template v0.7.4 (https://pluginjs.com) | ||
* Copyright 2018 Creation Studio Limited | ||
* @pluginjs/template v0.7.5 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
*/ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("@pluginjs/utils")):"function"==typeof define&&define.amd?define(["@pluginjs/utils"],n):t["@pluginjs/template"]=n(t["@pluginjs/utils"])}(this,function(t){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=/\{\s*([.0-9a-zA-Z_]+)\s*\}/g;function r(r){for(var o=arguments.length,u=new Array(o>1?o-1:0),l=1;l<o;l++)u[l-1]=arguments[l];return 1===u.length&&"object"===n(u[0])&&(u=u[0]),u&&u.hasOwnProperty||(u={}),r.replace(e,function(n,e,o){var l=null;return"{"===r[o-1]&&"}"===r[o+n.length]?e:(Object.prototype.hasOwnProperty.call(u,e)?l=u[e]:-1!==e.indexOf(".")&&(l=t.getValueByPath(u,e)),null==l?"":l)})}return{render:r,compile:function(t){return function(){for(var n=arguments.length,e=new Array(n),o=0;o<n;o++)e[o]=arguments[o];return r.apply(void 0,[t].concat(e))}},parse:function(t){var n=t.match(e);if(null===n)return!1;for(var r=[],o=0;o<n.length;o++)n[o].match(/^\{\{.+\}\}$/g)||r.push(n[o].substring(1,n[o].length-1).trim());return r}}}); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"category": "core", | ||
@@ -37,8 +37,8 @@ "main": "dist/template.common.js", | ||
"dependencies": { | ||
"@pluginjs/utils": "^0.7.4" | ||
"@pluginjs/utils": "^0.7.5" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.1.5", | ||
"@babel/core": "^7.2.2", | ||
"@pluginjs/browserslist-config": "^1.2.2", | ||
"@pluginjs/cli": "^0.7.4", | ||
"@pluginjs/cli": "^0.7.5", | ||
"babel-jest": "*", | ||
@@ -70,3 +70,3 @@ "jest": "*", | ||
"title": "Plugin", | ||
"gitHead": "15dd296725c971ec08d33abd1c655b205a52ade6" | ||
"gitHead": "a5b515ae1dc38f5f84fb18c70c322d361050593c" | ||
} |
Updated@pluginjs/utils@^0.7.5