Comparing version 2.0.2 to 3.0.0
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.pope={})}(this,function(e){"use strict";function n(e,n){if(!function(e){return null!==e&&"object"==typeof e}(e)||"string"!=typeof n)return e;for(var r=n.split("."),t=0;t<r.length;t++){var o=r[t];if(null===(e=e.hasOwnProperty(o)?e[o]:null))break}return e}e.pope=function(e,r,t){t=t||{skipUndefined:!1,throwOnUndefined:!1};for(var o,i=/{{2}(.+?)}{2}/g,f=e;null!==(o=i.exec(e));){var p=o[1].trim();if(p){var u=n(r,p);if(void 0!==u&&null!==u)f=f.replace(o[0],u);else{if(t.throwOnUndefined){var d=new Error("Missing value for "+o[0]);throw d.key=p,d.code="E_MISSING_KEY",d}t.skipUndefined||(f=f.replace(o[0],""))}}}return f},e.prop=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).pope={})}(this,function(e){"use strict";const i=(n=Object.prototype.hasOwnProperty,function(){return Function.call.apply(n,arguments)});var n;function u(n,e){if(null===(t=n)||"object"!=typeof t||"string"!=typeof e)return n;var t,o=e.split(".");for(let e=0;e<o.length;e++){var r=o[e];if(null===(n=i(n,r)?n[r]:null))break}return n}e.pope=function(e,n,t){t=t||{skipUndefined:!1,throwOnUndefined:!1};const o=/{{2}(.+?)}{2}/g;let r,i=e;for(;null!==(r=o.exec(e));){var f=r[1].trim();if(f){var l=u(n,f);if(null!=l)i=i.replace(r[0],l);else{if(t.throwOnUndefined){const p=new Error("Missing value for "+r[0]);throw p.key=f,p.code="E_MISSING_KEY",p}t.skipUndefined||(i=i.replace(r[0],""))}}}return i},e.prop=u,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,1 +0,1 @@ | ||
function isObj(r){return null!==r&&"object"==typeof r}function prop(r,e){if(!isObj(r)||"string"!=typeof e)return r;for(var n=e.split("."),i=0;i<n.length;i++){var o=n[i];if(null===(r=r.hasOwnProperty(o)?r[o]:null))break}return r}function pope(r,e,n){n=n||{skipUndefined:!1,throwOnUndefined:!1};for(var i,o=/{{2}(.+?)}{2}/g,p=r;null!==(i=o.exec(r));){var t=i[1].trim();if(t){var f=prop(e,t);if(void 0!==f&&null!==f)p=p.replace(i[0],f);else{if(n.throwOnUndefined){var l=new Error("Missing value for "+i[0]);throw l.key=t,l.code="E_MISSING_KEY",l}n.skipUndefined||(p=p.replace(i[0],""))}}}return p}export{pope,prop}; | ||
function uncurryThis(n){return function(){return Function.call.apply(n,arguments)}}const hasOwnProperty=uncurryThis(Object.prototype.hasOwnProperty);function isObj(n){return null!==n&&"object"==typeof n}function prop(r,n){if(!isObj(r)||"string"!=typeof n)return r;var e=n.split(".");for(let n=0;n<e.length;n++){var t=e[n];if(null===(r=hasOwnProperty(r,t)?r[t]:null))break}return r}function pope(n,r,e){e=e||{skipUndefined:!1,throwOnUndefined:!1};const t=/{{2}(.+?)}{2}/g;let o,i=n;for(;null!==(o=t.exec(n));){var p=o[1].trim();if(p){var u=prop(r,p);if(null!=u)i=i.replace(o[0],u);else{if(e.throwOnUndefined){const l=new Error("Missing value for "+o[0]);throw l.key=p,l.code="E_MISSING_KEY",l}e.skipUndefined||(i=i.replace(o[0],""))}}}return i}export{pope,prop}; |
@@ -1,1 +0,1 @@ | ||
"use strict";function isObj(e){return null!==e&&"object"==typeof e}function prop(e,r){if(!isObj(e)||"string"!=typeof r)return e;for(var n=r.split("."),o=0;o<n.length;o++){var p=n[o];if(null===(e=e.hasOwnProperty(p)?e[p]:null))break}return e}function pope(e,r,n){n=n||{skipUndefined:!1,throwOnUndefined:!1};for(var o,p=/{{2}(.+?)}{2}/g,t=e;null!==(o=p.exec(e));){var i=o[1].trim();if(i){var f=prop(r,i);if(void 0!==f&&null!==f)t=t.replace(o[0],f);else{if(n.throwOnUndefined){var l=new Error("Missing value for "+o[0]);throw l.key=i,l.code="E_MISSING_KEY",l}n.skipUndefined||(t=t.replace(o[0],""))}}}return t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.pope=pope,exports.prop=prop; | ||
"use strict";function uncurryThis(e){return function(){return Function.call.apply(e,arguments)}}Object.defineProperty(exports,"__esModule",{value:!0});const hasOwnProperty=uncurryThis(Object.prototype.hasOwnProperty);function isObj(e){return null!==e&&"object"==typeof e}function prop(r,e){if(!isObj(r)||"string"!=typeof e)return r;var n=e.split(".");for(let e=0;e<n.length;e++){var t=n[e];if(null===(r=hasOwnProperty(r,t)?r[t]:null))break}return r}function pope(e,r,n){n=n||{skipUndefined:!1,throwOnUndefined:!1};const t=/{{2}(.+?)}{2}/g;let o,p=e;for(;null!==(o=t.exec(e));){var i=o[1].trim();if(i){var u=prop(r,i);if(null!=u)p=p.replace(o[0],u);else{if(n.throwOnUndefined){const l=new Error("Missing value for "+o[0]);throw l.key=i,l.code="E_MISSING_KEY",l}n.skipUndefined||(p=p.replace(o[0],""))}}}return p}exports.pope=pope,exports.prop=prop; |
{ | ||
"name": "pope", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "Zero dependency micro templating engine for strings only.", | ||
@@ -8,6 +8,8 @@ "main": "dist/pope.js", | ||
"browser": "dist/pope.browser.js", | ||
"files": ["dist"], | ||
"scripts": { | ||
"build": "rollup -c rollup.config.js", | ||
"lint": "standard index.js test/*", | ||
"pretest": "npm run lint", | ||
"test": "japa" | ||
"test": "node test/pope.spec.js" | ||
}, | ||
@@ -25,8 +27,7 @@ "keywords": [ | ||
"devDependencies": { | ||
"coveralls": "^2.11.4", | ||
"japa": "^1.0.5", | ||
"japa-cli": "^1.0.1", | ||
"rollup": "^0.52.0", | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"standard": "^10.0.3", | ||
"coveralls": "^3.1.0", | ||
"japa": "^3.1.1", | ||
"rollup": "^2.42.2", | ||
"rollup-plugin-uglify": "^6.0.4", | ||
"standard": "^16.0.3", | ||
"uglify-es": "^3.2.0" | ||
@@ -33,0 +34,0 @@ }, |
6
7049
6
11