UNPKG

ng-string-parser

Version:

thick as a brick Angular string parser service

2 lines 1.02 kB
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ng-string-parser",["exports","@angular/core"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-string-parser"]={},e.ng.core)}(this,(function(e,r){"use strict";var t=function(){function e(){this.pattern="{value}"}return e.prototype.parse=function(e,r){var t=new Object;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];if("string"!=typeof o)throw new Error("In patterns, the value should be a string: "+n);var i=o.match(new RegExp("(.*)("+this.pattern+")(.*)"));if(i&&n in r){var a=Array.from(i).slice(1),s=a.indexOf(this.pattern);a[s]=String(r[n]),t[n]=a.join("")}else t[n]=o}return t},e.prototype.changePattern=function(e){if(!e)throw new Error("Pattern cannot be empty string");this.pattern=e},e}();t.decorators=[{type:r.Injectable}],e.ParserService=t,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-string-parser.umd.min.js.map