From 919b38e19753d91354fb415991759ae461355a48 Mon Sep 17 00:00:00 2001 From: Brian McCall Date: Wed, 10 Jan 2018 17:58:10 -0800 Subject: [PATCH] run build --- dist/setup.js | 96 ++++++++++++++++++++++------------------------- dist/setup.js.map | 2 +- 2 files changed, 45 insertions(+), 53 deletions(-) diff --git a/dist/setup.js b/dist/setup.js index d2b3d89..50326f5 100644 --- a/dist/setup.js +++ b/dist/setup.js @@ -1,59 +1,51 @@ 'use strict'; class LocalStorage { - constructor() { - Object.defineProperty(this, "getItem", { - enumerable: false, - value: jest.fn(key => { - return this[key] || null; - }) - - }); - Object.defineProperty(this, "setItem", { - enumerable: false, - value: jest.fn((key, val = '') => { - this[key] = val + ''; - }) - }); - Object.defineProperty(this, "removeItem", { - enumerable: false, - value: jest.fn(key => { - delete this[key]; - }) - }); - Object.defineProperty(this, "clear", { - enumerable: false, - value: jest.fn(() => { - Object.keys(this).map(key => delete this[key]); - }) - }); - Object.defineProperty(this, "toString", { - enumerable: false, - value: jest.fn(() => { - return "[object Storage]"; - }) - }); - Object.defineProperty(this, "key", { - enumerable: false, - value: jest.fn(idx => { - return Object.keys(this)[idx] || null; - }) - }); - } // end constructor - - get length() { - return Object.keys(this).length; - } - - get __STORE__() { - return this; - } + constructor(jest) { + Object.defineProperty(this, 'getItem', { + enumerable: false, + value: jest.fn(key => this[key] || null) + }); + Object.defineProperty(this, 'setItem', { + enumerable: false, + // not mentioned in the spec, but we must always coerce to a string + value: jest.fn((key, val = '') => { + this[key] = val + ''; + }) + }); + Object.defineProperty(this, 'removeItem', { + enumerable: false, + value: jest.fn(key => { + delete this[key]; + }) + }); + Object.defineProperty(this, 'clear', { + enumerable: false, + value: jest.fn(() => { + Object.keys(this).map(key => delete this[key]); + }) + }); + Object.defineProperty(this, 'toString', { + enumerable: false, + value: jest.fn(() => { + return '[object Storage]'; + }) + }); + Object.defineProperty(this, 'key', { + enumerable: false, + value: jest.fn(idx => Object.keys(this)[idx] || null) + }); + } // end constructor + get length() { + return Object.keys(this).length; + } + // for backwards compatibility + get __STORE__() { + return this; + } } -const local = new LocalStorage(); -const session = new LocalStorage(); - -global.localStorage = local; -global.sessionStorage = session; +global.localStorage = new LocalStorage(jest); +global.sessionStorage = new LocalStorage(jest); //# sourceMappingURL=setup.js.map diff --git a/dist/setup.js.map b/dist/setup.js.map index 7cc37c2..81f7469 100644 --- a/dist/setup.js.map +++ b/dist/setup.js.map @@ -1 +1 @@ -{"version":3,"file":"setup.js","sources":["../src/localstorage.js","../src/setup.js"],"sourcesContent":["export class LocalStorage {\n constructor() {\n Object.defineProperty(this, \"getItem\", {\n enumerable: false,\n value: jest.fn((key) => {return this[key] || null })\n\n });\n Object.defineProperty(this, \"setItem\", {\n enumerable: false,\n value: jest.fn((key, val = '') => {\n this[key] = val + '';\n })\n });\n Object.defineProperty(this, \"removeItem\", {\n enumerable: false,\n value: jest.fn((key) => {\n delete this[key];\n })\n });\n Object.defineProperty(this, \"clear\", {\n enumerable: false,\n value: jest.fn(() => {\n Object.keys(this).map(key => delete this[key]);\n\n })\n });\n Object.defineProperty(this, \"toString\", {\n enumerable: false,\n value: jest.fn(() => {\n return \"[object Storage]\"\n\n })\n });\n Object.defineProperty(this, \"key\", {\n enumerable: false,\n value: jest.fn((idx) => {\n return Object.keys(this)[idx] || null\n })\n });\n\n } // end constructor\n\n get length() {\n return Object.keys(this).length\n }\n\n get __STORE__() {\n return this\n }\n\n}\n\n","import { LocalStorage } from './localstorage';\n\nconst local = new LocalStorage();\nconst session = new LocalStorage();\n\nglobal.localStorage = local;\nglobal.sessionStorage = session;\n\n\n"],"names":["LocalStorage","defineProperty","jest","fn","key","val","keys","map","idx","Object","length","__STORE__","local","session","global","localStorage","sessionStorage"],"mappings":";;AAAO,MAAMA,YAAN,CAAoB;kBACT;eACHC,cAAP,CAAsB,IAAtB,EAA4B,SAA5B,EAAuC;wBACvB,KADuB;mBAE5BC,KAAKC,EAAL,CAASC,GAAD,IAAS;uBAAQ,KAAKA,GAAL,KAAa,IAApB;aAAlB;;SAFX;eAKOH,cAAP,CAAsB,IAAtB,EAA4B,SAA5B,EAAuC;wBACvB,KADuB;mBAE5BC,KAAKC,EAAL,CAAQ,CAACC,GAAD,EAAMC,MAAM,EAAZ,KAAmB;qBACzBD,GAAL,IAAYC,MAAM,EAAlB;aADG;SAFX;eAMOJ,cAAP,CAAsB,IAAtB,EAA4B,YAA5B,EAA0C;wBAC1B,KAD0B;mBAE/BC,KAAKC,EAAL,CAASC,GAAD,IAAS;uBACb,KAAKA,GAAL,CAAP;aADG;SAFX;eAMOH,cAAP,CAAsB,IAAtB,EAA4B,OAA5B,EAAqC;wBACrB,KADqB;mBAE1BC,KAAKC,EAAL,CAAQ,MAAM;uBACVG,IAAP,CAAY,IAAZ,EAAkBC,GAAlB,CAAsBH,OAAO,OAAO,KAAKA,GAAL,CAApC;aADG;SAFX;eAOOH,cAAP,CAAsB,IAAtB,EAA4B,UAA5B,EAAwC;wBACxB,KADwB;mBAE7BC,KAAKC,EAAL,CAAQ,MAAM;uBACV,kBAAP;aADG;SAFX;eAOOF,cAAP,CAAsB,IAAtB,EAA4B,KAA5B,EAAmC;wBACnB,KADmB;mBAExBC,KAAKC,EAAL,CAASK,GAAD,IAAS;uBACbC,OAAOH,IAAP,CAAY,IAAZ,EAAkBE,GAAlB,KAA0B,IAAjC;aADG;SAFX;KAjCmB;;QA0CnBE,MAAJ,GAAa;eACFD,OAAOH,IAAP,CAAY,IAAZ,EAAkBI,MAAzB;;;QAGAC,SAAJ,GAAgB;eACL,IAAP;;;;;AC7CR,MAAMC,QAAQ,IAAIZ,YAAJ,EAAd;AACA,MAAMa,UAAU,IAAIb,YAAJ,EAAhB;;AAEAc,OAAOC,YAAP,GAAsBH,KAAtB;AACAE,OAAOE,cAAP,GAAwBH,OAAxB"} \ No newline at end of file +{"version":3,"file":"setup.js","sources":["../src/localstorage.js","../src/setup.js"],"sourcesContent":["export class LocalStorage {\n constructor(jest) {\n Object.defineProperty(this, 'getItem', {\n enumerable: false,\n value: jest.fn(key => this[key] || null),\n });\n Object.defineProperty(this, 'setItem', {\n enumerable: false,\n // not mentioned in the spec, but we must always coerce to a string\n value: jest.fn((key, val = '') => {\n this[key] = val + '';\n }),\n });\n Object.defineProperty(this, 'removeItem', {\n enumerable: false,\n value: jest.fn(key => {\n delete this[key];\n }),\n });\n Object.defineProperty(this, 'clear', {\n enumerable: false,\n value: jest.fn(() => {\n Object.keys(this).map(key => delete this[key]);\n }),\n });\n Object.defineProperty(this, 'toString', {\n enumerable: false,\n value: jest.fn(() => {\n return '[object Storage]';\n }),\n });\n Object.defineProperty(this, 'key', {\n enumerable: false,\n value: jest.fn(idx => Object.keys(this)[idx] || null),\n });\n } // end constructor\n\n get length() {\n return Object.keys(this).length;\n }\n // for backwards compatibility\n get __STORE__() {\n return this;\n }\n}\n","import { LocalStorage } from './localstorage';\n\nglobal.localStorage = new LocalStorage(jest);\nglobal.sessionStorage = new LocalStorage(jest);\n"],"names":["LocalStorage","jest","defineProperty","fn","key","val","keys","map","idx","Object","length","__STORE__","global","localStorage","sessionStorage"],"mappings":";;AAAO,MAAMA,YAAN,CAAmB;cACZC,IAAZ,EAAkB;WACTC,cAAP,CAAsB,IAAtB,EAA4B,SAA5B,EAAuC;kBACzB,KADyB;aAE9BD,KAAKE,EAAL,CAAQC,OAAO,KAAKA,GAAL,KAAa,IAA5B;KAFT;WAIOF,cAAP,CAAsB,IAAtB,EAA4B,SAA5B,EAAuC;kBACzB,KADyB;;aAG9BD,KAAKE,EAAL,CAAQ,CAACC,GAAD,EAAMC,MAAM,EAAZ,KAAmB;aAC3BD,GAAL,IAAYC,MAAM,EAAlB;OADK;KAHT;WAOOH,cAAP,CAAsB,IAAtB,EAA4B,YAA5B,EAA0C;kBAC5B,KAD4B;aAEjCD,KAAKE,EAAL,CAAQC,OAAO;eACb,KAAKA,GAAL,CAAP;OADK;KAFT;WAMOF,cAAP,CAAsB,IAAtB,EAA4B,OAA5B,EAAqC;kBACvB,KADuB;aAE5B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