diff --git a/dist/smallstache.js b/dist/smallstache.js index b024550..bfea5b1 100644 --- a/dist/smallstache.js +++ b/dist/smallstache.js @@ -10,14 +10,13 @@ factory(mod.exports); global.Smallstache = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); - _exports.default = Smallstache; - + _exports["default"] = Smallstache; /* Smallstache - a JavaScript template engine. @@ -34,9 +33,9 @@ if (typeof source !== 'string') { throw new TypeError('Template source must be a string'); } - this.source = source; } + /* Fill template with data object. @@ -46,13 +45,10 @@ Returns: A string with tags replaced by corresponding data. */ - - Smallstache.prototype.fill = function (data) { function fillTemplate(tag, name) { return data[name] != null ? data[name] : tag; } - return this.source.replace(/{{\s*([^}\s]+)\s*}}/g, fillTemplate); }; }); diff --git a/dist/smallstache.min.js b/dist/smallstache.min.js index 642eb86..560c69e 100644 --- a/dist/smallstache.min.js +++ b/dist/smallstache.min.js @@ -1,2 +1,2 @@ -!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={};t(n),e.Smallstache=n}}(this,function(e){"use strict";function t(e){if("string"!=typeof e)throw new TypeError("Template source must be a string");this.source=e}Object.defineProperty(e,"__esModule",{value:!0}),(e.default=t).prototype.fill=function(n){return this.source.replace(/{{\s*([^}\s]+)\s*}}/g,function(e,t){return null!=n[t]?n[t]:e})}}); +!function(e,t){"function"==typeof define&&define.amd?define(["exports"],t):"undefined"!=typeof exports?t(exports):(t(t={}),e.Smallstache=t)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e){"use strict";function t(e){if("string"!=typeof e)throw new TypeError("Template source must be a string");this.source=e}Object.defineProperty(e,"__esModule",{value:!0}),(e.default=t).prototype.fill=function(n){return this.source.replace(/{{\s*([^}\s]+)\s*}}/g,function(e,t){return null!=n[t]?n[t]:e})}}); //# sourceMappingURL=./smallstache.js.map \ No newline at end of file diff --git a/package.json b/package.json index 1a74296..6d111d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smallstache", - "version": "0.5.1", + "version": "0.5.2", "description": "Lightweight template engine similar to Mustache/Handlebars.", "keywords": [ "smallstache", @@ -17,18 +17,18 @@ "lint": "eslint src tests" }, "devDependencies": { - "@babel/cli": "7.1.x", - "@babel/core": "7.1.x", - "@babel/plugin-transform-modules-umd": "7.1.x", - "@babel/preset-env": "7.1.x", + "@babel/cli": "7.19.x", + "@babel/core": "7.20.x", + "@babel/plugin-transform-modules-umd": "7.18.x", + "@babel/preset-env": "7.20.x", "babel-core": "^7.0.0-bridge.0", - "babel-jest": "23.6.x", - "eslint": "5.6.x", - "jest": "23.6.x", - "mkdirp": "0.5.x", + "babel-jest": "29.3.x", + "eslint": "8.28.x", + "jest": "29.3.x", + "mkdirp": "1.0.x", "npm-check-updates": "^16.4.1", - "regenerator-runtime": "0.12.x", - "uglify-js": "3.4.x" + "regenerator-runtime": "0.13.x", + "uglify-js": "3.17.x" }, "files": [ "dist",