+11
-11
| { | ||
| "version": "0.3.2", | ||
| "version": "0.4.0", | ||
| "license": "MIT", | ||
@@ -23,9 +23,9 @@ "name": "normi", | ||
| ], | ||
| "main": "dist/index.js", | ||
| "typings": "dist/index.d.ts", | ||
| "main": "lib/index.js", | ||
| "typings": "lib/index.d.ts", | ||
| "files": [ | ||
| "dist" | ||
| "lib" | ||
| ], | ||
| "scripts": { | ||
| "clean": "rm -rf dist/*", | ||
| "clean": "rm -rf lib/*", | ||
| "start": "tsdx watch", | ||
@@ -37,7 +37,5 @@ "build": "npm run clean && tsdx build", | ||
| "play": "nodemon -e ts -w src -x ts-node --project dev.tsconfig.json src/playground.ts", | ||
| "buildplay": "nodemon -e ts -w src -x 'tsc --project dev.tsconfig.json && node dist/index.js'" | ||
| "buildplay": "nodemon -e ts -w src -x 'tsc --project dev.tsconfig.json && node lib/index.js'" | ||
| }, | ||
| "peerDependencies": { | ||
| "mobx": "^5" | ||
| }, | ||
| "peerDependencies": {}, | ||
| "husky": { | ||
@@ -54,9 +52,11 @@ "hooks": { | ||
| }, | ||
| "module": "dist/normi.esm.js", | ||
| "module": "lib/normi.esm.js", | ||
| "devDependencies": { | ||
| "husky": "^4.2.5", | ||
| "mobx": "^6.0.2", | ||
| "tsdx": "^0.13.2", | ||
| "tslib": "^2.0.0", | ||
| "typescript": "^3.9.5" | ||
| } | ||
| }, | ||
| "dependencies": {} | ||
| } |
+17
-2
@@ -46,3 +46,3 @@ <h1 align="center">Normi</h1> | ||
| The hard part is knowing when two objects correspond to the same node. By default, Normi only has two criteria for a node: | ||
| The hard part is knowing when two objects correspond to the same node. **By default**, Normi only has two criteria for a node: | ||
@@ -56,2 +56,15 @@ 1. Must be a plain JavaScript object (not an array or instance) | ||
| #### Custom ID key | ||
| If you use a different key to store object identifers, you can use that instead: | ||
| ```ts | ||
| const normi = new Normi({ id: '__ID__' }); | ||
| normi.merge({ | ||
| __ID__: '1234', | ||
| size: 'Venti', | ||
| }); | ||
| ``` | ||
| #### GraphQL | ||
@@ -75,5 +88,7 @@ | ||
| // generate a string from your object | ||
| return data.id; | ||
| if (data.uid) return data.uid; | ||
| if (data.id) return `__${data.id}`; | ||
| return `${Math.random()}`; | ||
| }, | ||
| }); | ||
| ``` |
| import { Normi } from './store'; | ||
| export { Normi }; |
| 'use strict' | ||
| if (process.env.NODE_ENV === 'production') { | ||
| module.exports = require('./normi.cjs.production.min.js') | ||
| } else { | ||
| module.exports = require('./normi.cjs.development.js') | ||
| } |
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| var tslib = require('tslib'); | ||
| var mobx = require('mobx'); | ||
| var util; | ||
| (function (util) { | ||
| util.randomId = function () { | ||
| return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); | ||
| }; | ||
| util.isPrimitive = function (val) { | ||
| return val !== Object(val); | ||
| }; | ||
| })(util || (util = {})); | ||
| var Normi = function Normi(params) { | ||
| var _this = this; | ||
| if (params === void 0) { | ||
| params = {}; | ||
| } | ||
| this.getId = function (data) { | ||
| if (typeof _this.params.id === 'function') { | ||
| return _this.params.id(data); | ||
| } else if (Array.isArray(_this.params.id)) { | ||
| return _this.params.id.map(function (k) { | ||
| if (data && data[k] && util.isPrimitive(data[k])) { | ||
| return data[k]; | ||
| } | ||
| return util.randomId(); | ||
| }).join('_'); | ||
| } else { | ||
| return util.randomId(); | ||
| } | ||
| }; | ||
| this.get = function (id) { | ||
| return _this.nodes[id] || null; | ||
| }; | ||
| this.nodes = {}; | ||
| this.merge = function (rawData) { | ||
| // let id; | ||
| var data = rawData; | ||
| var id = _this.getId(data); | ||
| var node = _this.nodes[id] || {}; | ||
| if (util.isPrimitive(data)) { | ||
| return { | ||
| value: data | ||
| }; | ||
| } else if (Array.isArray(data)) { | ||
| node.value = data.map(function (el) { | ||
| return _this.merge(el).value; | ||
| }); | ||
| } else if (typeof data === 'object') { | ||
| if (!node.value) node.value = {}; | ||
| for (var key in data) { | ||
| node.value[key] = _this.merge(data[key]).value; | ||
| } | ||
| } else { | ||
| node.value = data; | ||
| } | ||
| _this.nodes[id] = node; | ||
| return _this.nodes[id]; | ||
| }; | ||
| this.params = { | ||
| id: params.id || ['id'] | ||
| }; | ||
| }; | ||
| tslib.__decorate([mobx.observable], Normi.prototype, "nodes", void 0); | ||
| tslib.__decorate([mobx.action], Normi.prototype, "merge", void 0); | ||
| exports.Normi = Normi; | ||
| //# sourceMappingURL=normi.cjs.development.js.map |
| {"version":3,"file":"normi.cjs.development.js","sources":["../src/util.ts","../src/store.ts"],"sourcesContent":["export namespace util {\n export const randomId = () =>\n Math.random()\n .toString(36)\n .substring(2, 15) +\n Math.random()\n .toString(36)\n .substring(2, 15);\n\n export const isPrimitive = (val: any) => val !== Object(val);\n}\n","import { action, observable } from 'mobx';\nimport { util } from './util';\n\ntype NormiParams = {\n id: ((arg: any) => string) | string[];\n};\n\nexport class Normi {\n params: NormiParams;\n constructor(params: Partial<NormiParams> = {}) {\n this.params = {\n id: params.id || ['id'],\n };\n }\n\n getId = (data: any) => {\n if (typeof this.params.id === 'function') {\n return this.params.id(data);\n } else if (Array.isArray(this.params.id)) {\n return this.params.id\n .map(k => {\n if (data && data[k] && util.isPrimitive(data[k])) {\n return data[k];\n }\n return util.randomId();\n })\n .join('_');\n } else {\n return util.randomId();\n }\n };\n\n get = (id: string) => {\n return this.nodes[id] || null;\n };\n\n @observable nodes: { [k: string]: { value: any } } = {};\n\n @action merge = <T extends any>(rawData: T): { value: T } => {\n // let id;\n const data: any = rawData;\n const id = this.getId(data);\n\n const node = this.nodes[id] || {};\n\n if (util.isPrimitive(data)) {\n return { value: data };\n } else if (Array.isArray(data)) {\n node.value = data.map((el: any) => {\n return this.merge(el).value;\n });\n } else if (typeof data === 'object') {\n if (!node.value) node.value = {};\n for (let key in data) {\n node.value[key] = this.merge(data[key]).value;\n }\n } else {\n node.value = data;\n }\n\n this.nodes[id] = node;\n return this.nodes[id];\n };\n}\n"],"names":["util","Math","random","toString","substring","val","Object","Normi","params","data","id","Array","isArray","map","k","isPrimitive","randomId","join","nodes","rawData","getId","node","value","el","merge","key","__decorate","observable","action"],"mappings":";;;;;;;IAAiBA;;AAAjB,WAAiBA;AACFA,EAAAA,aAAA,GAAW;AAAA,WACtBC,IAAI,CAACC,MAAL,GACGC,QADH,CACY,EADZ,EAEGC,SAFH,CAEa,CAFb,EAEgB,EAFhB,IAGAH,IAAI,CAACC,MAAL,GACGC,QADH,CACY,EADZ,EAEGC,SAFH,CAEa,CAFb,EAEgB,EAFhB,CAJsB;AAAA,GAAX;;AAQAJ,EAAAA,gBAAA,GAAc,UAACK,GAAD;AAAA,WAAcA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAA5B;AAAA,GAAd;AACd,CAVD,EAAiBL,IAAI,KAAJA,IAAI,KAAA,CAArB;;ICOaO,KAAb,GAEE,eAAYC,MAAZ;;;MAAYA;AAAAA,IAAAA,SAA+B;;;AAM3C,YAAA,GAAQ,UAACC,IAAD;AACN,QAAI,OAAO,KAAI,CAACD,MAAL,CAAYE,EAAnB,KAA0B,UAA9B,EAA0C;AACxC,aAAO,KAAI,CAACF,MAAL,CAAYE,EAAZ,CAAeD,IAAf,CAAP;AACD,KAFD,MAEO,IAAIE,KAAK,CAACC,OAAN,CAAc,KAAI,CAACJ,MAAL,CAAYE,EAA1B,CAAJ,EAAmC;AACxC,aAAO,KAAI,CAACF,MAAL,CAAYE,EAAZ,CACJG,GADI,CACA,UAAAC,CAAC;AACJ,YAAIL,IAAI,IAAIA,IAAI,CAACK,CAAD,CAAZ,IAAmBd,IAAI,CAACe,WAAL,CAAiBN,IAAI,CAACK,CAAD,CAArB,CAAvB,EAAkD;AAChD,iBAAOL,IAAI,CAACK,CAAD,CAAX;AACD;;AACD,eAAOd,IAAI,CAACgB,QAAL,EAAP;AACD,OANI,EAOJC,IAPI,CAOC,GAPD,CAAP;AAQD,KATM,MASA;AACL,aAAOjB,IAAI,CAACgB,QAAL,EAAP;AACD;AACF,GAfD;;AAiBA,UAAA,GAA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AAD;AADL,GAAd;AAGD,CANH;;AA6BcgB,kBAAXC,mDAAW;;AAEJD,kBAAPE,+CAAO;;;;"} |
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),i=require("mobx");!function(e){e.randomId=function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)},e.isPrimitive=function(e){return e!==Object(e)}}(e||(e={}));var t=function(r){var i=this;void 0===r&&(r={}),this.getId=function(r){return"function"==typeof i.params.id?i.params.id(r):Array.isArray(i.params.id)?i.params.id.map((function(i){return r&&r[i]&&e.isPrimitive(r[i])?r[i]:e.randomId()})).join("_"):e.randomId()},this.get=function(e){return i.nodes[e]||null},this.nodes={},this.merge=function(r){var t=r,n=i.getId(t),o=i.nodes[n]||{};if(e.isPrimitive(t))return{value:t};if(Array.isArray(t))o.value=t.map((function(e){return i.merge(e).value}));else if("object"==typeof t)for(var a in o.value||(o.value={}),t)o.value[a]=i.merge(t[a]).value;else o.value=t;return i.nodes[n]=o,i.nodes[n]},this.params={id:r.id||["id"]}};r.__decorate([i.observable],t.prototype,"nodes",void 0),r.__decorate([i.action],t.prototype,"merge",void 0),exports.Normi=t; | ||
| //# sourceMappingURL=normi.cjs.production.min.js.map |
| {"version":3,"file":"normi.cjs.production.min.js","sources":["../src/util.ts","../src/store.ts"],"sourcesContent":["export namespace util {\n export const randomId = () =>\n Math.random()\n .toString(36)\n .substring(2, 15) +\n Math.random()\n .toString(36)\n .substring(2, 15);\n\n export const isPrimitive = (val: any) => val !== Object(val);\n}\n","import { action, observable } from 'mobx';\nimport { util } from './util';\n\ntype NormiParams = {\n id: ((arg: any) => string) | string[];\n};\n\nexport class Normi {\n params: NormiParams;\n constructor(params: Partial<NormiParams> = {}) {\n this.params = {\n id: params.id || ['id'],\n };\n }\n\n getId = (data: any) => {\n if (typeof this.params.id === 'function') {\n return this.params.id(data);\n } else if (Array.isArray(this.params.id)) {\n return this.params.id\n .map(k => {\n if (data && data[k] && util.isPrimitive(data[k])) {\n return data[k];\n }\n return util.randomId();\n })\n .join('_');\n } else {\n return util.randomId();\n }\n };\n\n get = (id: string) => {\n return this.nodes[id] || null;\n };\n\n @observable nodes: { [k: string]: { value: any } } = {};\n\n @action merge = <T extends any>(rawData: T): { value: T } => {\n // let id;\n const data: any = rawData;\n const id = this.getId(data);\n\n const node = this.nodes[id] || {};\n\n if (util.isPrimitive(data)) {\n return { value: data };\n } else if (Array.isArray(data)) {\n node.value = data.map((el: any) => {\n return this.merge(el).value;\n });\n } else if (typeof data === 'object') {\n if (!node.value) node.value = {};\n for (let key in data) {\n node.value[key] = this.merge(data[key]).value;\n }\n } else {\n node.value = data;\n }\n\n this.nodes[id] = node;\n return this.nodes[id];\n };\n}\n"],"names":["util","Math","random","toString","substring","val","Object","Normi","params","data","_this","id","Array","isArray","map","k","isPrimitive","randomId","join","nodes","rawData","getId","node","value","el","merge","key","__decorate","observable","action"],"mappings":"wEAAiBA,wCAAjB,SAAiBA,GACFA,WAAW,kBACtBC,KAAKC,SACFC,SAAS,IACTC,UAAU,EAAG,IAChBH,KAAKC,SACFC,SAAS,IACTC,UAAU,EAAG,KAELJ,cAAc,SAACK,UAAaA,IAAQC,OAAOD,IAT1D,CAAiBL,IAAAA,WCOJO,EAEX,SAAYC,uBAAAA,IAAAA,EAA+B,eAMnC,SAACC,SACuB,mBAAnBC,EAAKF,OAAOG,GACdD,EAAKF,OAAOG,GAAGF,GACbG,MAAMC,QAAQH,EAAKF,OAAOG,IAC5BD,EAAKF,OAAOG,GAChBG,KAAI,SAAAC,UACCN,GAAQA,EAAKM,IAAMf,EAAKgB,YAAYP,EAAKM,IACpCN,EAAKM,GAEPf,EAAKiB,cAEbC,KAAK,KAEDlB,EAAKiB,qBAIV,SAACN,UACED,EAAKS,MAAMR,IAAO,iBAG0B,cAErC,SAAgBS,OAExBX,EAAYW,EACZT,EAAKD,EAAKW,MAAMZ,GAEhBa,EAAOZ,EAAKS,MAAMR,IAAO,MAE3BX,EAAKgB,YAAYP,SACZ,CAAEc,MAAOd,GACX,GAAIG,MAAMC,QAAQJ,GACvBa,EAAKC,MAAQd,EAAKK,KAAI,SAACU,UACdd,EAAKe,MAAMD,GAAID,cAEnB,GAAoB,iBAATd,MAEX,IAAIiB,KADJJ,EAAKC,QAAOD,EAAKC,MAAQ,IACdd,EACda,EAAKC,MAAMG,GAAOhB,EAAKe,MAAMhB,EAAKiB,IAAMH,WAG1CD,EAAKC,MAAQd,SAGfC,EAAKS,MAAMR,GAAMW,EACVZ,EAAKS,MAAMR,SAnDbH,OAAS,CACZG,GAAIH,EAAOG,IAAM,CAAC,QAyBVgB,cAAXC,0CAEOD,cAAPE"} |
| import { __decorate } from 'tslib'; | ||
| import { observable, action } from 'mobx'; | ||
| var util; | ||
| (function (util) { | ||
| util.randomId = function () { | ||
| return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); | ||
| }; | ||
| util.isPrimitive = function (val) { | ||
| return val !== Object(val); | ||
| }; | ||
| })(util || (util = {})); | ||
| var Normi = function Normi(params) { | ||
| var _this = this; | ||
| if (params === void 0) { | ||
| params = {}; | ||
| } | ||
| this.getId = function (data) { | ||
| if (typeof _this.params.id === 'function') { | ||
| return _this.params.id(data); | ||
| } else if (Array.isArray(_this.params.id)) { | ||
| return _this.params.id.map(function (k) { | ||
| if (data && data[k] && util.isPrimitive(data[k])) { | ||
| return data[k]; | ||
| } | ||
| return util.randomId(); | ||
| }).join('_'); | ||
| } else { | ||
| return util.randomId(); | ||
| } | ||
| }; | ||
| this.get = function (id) { | ||
| return _this.nodes[id] || null; | ||
| }; | ||
| this.nodes = {}; | ||
| this.merge = function (rawData) { | ||
| // let id; | ||
| var data = rawData; | ||
| var id = _this.getId(data); | ||
| var node = _this.nodes[id] || {}; | ||
| if (util.isPrimitive(data)) { | ||
| return { | ||
| value: data | ||
| }; | ||
| } else if (Array.isArray(data)) { | ||
| node.value = data.map(function (el) { | ||
| return _this.merge(el).value; | ||
| }); | ||
| } else if (typeof data === 'object') { | ||
| if (!node.value) node.value = {}; | ||
| for (var key in data) { | ||
| node.value[key] = _this.merge(data[key]).value; | ||
| } | ||
| } else { | ||
| node.value = data; | ||
| } | ||
| _this.nodes[id] = node; | ||
| return _this.nodes[id]; | ||
| }; | ||
| this.params = { | ||
| id: params.id || ['id'] | ||
| }; | ||
| }; | ||
| __decorate([observable], Normi.prototype, "nodes", void 0); | ||
| __decorate([action], Normi.prototype, "merge", void 0); | ||
| export { Normi }; | ||
| //# sourceMappingURL=normi.esm.js.map |
| {"version":3,"file":"normi.esm.js","sources":["../src/util.ts","../src/store.ts"],"sourcesContent":["export namespace util {\n export const randomId = () =>\n Math.random()\n .toString(36)\n .substring(2, 15) +\n Math.random()\n .toString(36)\n .substring(2, 15);\n\n export const isPrimitive = (val: any) => val !== Object(val);\n}\n","import { action, observable } from 'mobx';\nimport { util } from './util';\n\ntype NormiParams = {\n id: ((arg: any) => string) | string[];\n};\n\nexport class Normi {\n params: NormiParams;\n constructor(params: Partial<NormiParams> = {}) {\n this.params = {\n id: params.id || ['id'],\n };\n }\n\n getId = (data: any) => {\n if (typeof this.params.id === 'function') {\n return this.params.id(data);\n } else if (Array.isArray(this.params.id)) {\n return this.params.id\n .map(k => {\n if (data && data[k] && util.isPrimitive(data[k])) {\n return data[k];\n }\n return util.randomId();\n })\n .join('_');\n } else {\n return util.randomId();\n }\n };\n\n get = (id: string) => {\n return this.nodes[id] || null;\n };\n\n @observable nodes: { [k: string]: { value: any } } = {};\n\n @action merge = <T extends any>(rawData: T): { value: T } => {\n // let id;\n const data: any = rawData;\n const id = this.getId(data);\n\n const node = this.nodes[id] || {};\n\n if (util.isPrimitive(data)) {\n return { value: data };\n } else if (Array.isArray(data)) {\n node.value = data.map((el: any) => {\n return this.merge(el).value;\n });\n } else if (typeof data === 'object') {\n if (!node.value) node.value = {};\n for (let key in data) {\n node.value[key] = this.merge(data[key]).value;\n }\n } else {\n node.value = data;\n }\n\n this.nodes[id] = node;\n return this.nodes[id];\n };\n}\n"],"names":["util","Math","random","toString","substring","val","Object","Normi","params","data","id","Array","isArray","map","k","isPrimitive","randomId","join","nodes","rawData","getId","node","value","el","merge","key","__decorate","observable","action"],"mappings":";;;IAAiBA;;AAAjB,WAAiBA;AACFA,EAAAA,aAAA,GAAW;AAAA,WACtBC,IAAI,CAACC,MAAL,GACGC,QADH,CACY,EADZ,EAEGC,SAFH,CAEa,CAFb,EAEgB,EAFhB,IAGAH,IAAI,CAACC,MAAL,GACGC,QADH,CACY,EADZ,EAEGC,SAFH,CAEa,CAFb,EAEgB,EAFhB,CAJsB;AAAA,GAAX;;AAQAJ,EAAAA,gBAAA,GAAc,UAACK,GAAD;AAAA,WAAcA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAA5B;AAAA,GAAd;AACd,CAVD,EAAiBL,IAAI,KAAJA,IAAI,KAAA,CAArB;;ICOaO,KAAb,GAEE,eAAYC,MAAZ;;;MAAYA;AAAAA,IAAAA,SAA+B;;;AAM3C,YAAA,GAAQ,UAACC,IAAD;AACN,QAAI,OAAO,KAAI,CAACD,MAAL,CAAYE,EAAnB,KAA0B,UAA9B,EAA0C;AACxC,aAAO,KAAI,CAACF,MAAL,CAAYE,EAAZ,CAAeD,IAAf,CAAP;AACD,KAFD,MAEO,IAAIE,KAAK,CAACC,OAAN,CAAc,KAAI,CAACJ,MAAL,CAAYE,EAA1B,CAAJ,EAAmC;AACxC,aAAO,KAAI,CAACF,MAAL,CAAYE,EAAZ,CACJG,GADI,CACA,UAAAC,CAAC;AACJ,YAAIL,IAAI,IAAIA,IAAI,CAACK,CAAD,CAAZ,IAAmBd,IAAI,CAACe,WAAL,CAAiBN,IAAI,CAACK,CAAD,CAArB,CAAvB,EAAkD;AAChD,iBAAOL,IAAI,CAACK,CAAD,CAAX;AACD;;AACD,eAAOd,IAAI,CAACgB,QAAL,EAAP;AACD,OANI,EAOJC,IAPI,CAOC,GAPD,CAAP;AAQD,KATM,MASA;AACL,aAAOjB,IAAI,CAACgB,QAAL,EAA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AEF,MAAM,CAACE,EAAP,IAAa,CAAC,IAAD;AADL,GAAd;AAGD,CANH;;AA6BcgB,YAAXC,8CAAW;;AAEJD,YAAPE,0CAAO;;;;"} |
| export declare const play: () => Promise<void>; |
| declare type NormiParams = { | ||
| id: ((arg: any) => string) | string[]; | ||
| }; | ||
| export declare class Normi { | ||
| params: NormiParams; | ||
| constructor(params?: Partial<NormiParams>); | ||
| getId: (data: any) => string; | ||
| get: (id: string) => { | ||
| value: any; | ||
| }; | ||
| nodes: { | ||
| [k: string]: { | ||
| value: any; | ||
| }; | ||
| }; | ||
| merge: <T extends unknown>(rawData: T) => { | ||
| value: T; | ||
| }; | ||
| } | ||
| export {}; |
| export declare namespace util { | ||
| const randomId: () => string; | ||
| const isPrimitive: (val: any) => boolean; | ||
| } |
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
-100%1
-50%92
19.48%0
-100%6364
-73.1%5
25%3
-78.57%0
-100%1
Infinity%