UNPKG

json-restyle

Version:
2 lines 1.81 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("json-restyle",["exports","@angular/core","@angular/common"],n):n(e["json-restyle"]={},e.ng.core,e.ng.common)}(this,function(e,n,t){"use strict";var r=function(){function e(){}return e.prototype.reform=function(e,n){var t;if(e instanceof Array){t=JSON.parse(JSON.stringify({array:e})).array;for(var r=0;r<t.length;r++)for(var o in n)t[r][n[o]]=t[r][o],delete t[r][o];return t}if(e instanceof Object){for(var o in t=JSON.parse(JSON.stringify(e)),n)t[n[o]]=t[o],delete t[o];return t}return e},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ngInjectableDef=n.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),o=function(){function e(e){this.jsonService=e}return e.prototype.ngOnInit=function(){},e.prototype.ngOnChanges=function(e){(e&&e.data&&e.data.previousValue!=e.data.currentValue||e.mapping&&e.mapping.previousValue!=e.mapping.currentValue)&&(this.modifiedData=this.jsonService.reform(this.data,this.mapping))},e.decorators=[{type:n.Component,args:[{selector:"json-restyle",template:"\n <p>\n Raw Data: {{data | json}}\n </p>\n <p>\n Modified Data: {{modifiedData | json}}\n </p>\n ",styles:[]}]}],e.ctorParameters=function(){return[{type:r}]},e.propDecorators={data:[{type:n.Input}],mapping:[{type:n.Input}]},e}(),a=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{imports:[t.CommonModule],declarations:[o],exports:[o]}]}],e}();e.JsonRestyleService=r,e.JsonRestyleComponent=o,e.JsonRestyleModule=a,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=json-restyle.umd.min.js.map