diff --git a/.gitignore b/.gitignore index c9a3219..328ffa6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules bower_components -dist/FakeRest.js +dist example/ng-admin/bower-components diff --git a/dist/FakeRest.js.map b/dist/FakeRest.js.map deleted file mode 100644 index aa2c2c0..0000000 --- a/dist/FakeRest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://FakeRest/webpack/universalModuleDefinition","webpack://FakeRest/./src/Collection.js","webpack://FakeRest/./src/Single.js","webpack://FakeRest/./src/parseQueryString.js","webpack://FakeRest/./src/Server.js","webpack://FakeRest/./src/FetchServer.js","webpack://FakeRest/./src/FakeRest.js","webpack://FakeRest/./node_modules/lodash/_Hash.js","webpack://FakeRest/./node_modules/lodash/_ListCache.js","webpack://FakeRest/./node_modules/lodash/_Map.js","webpack://FakeRest/./node_modules/lodash/_MapCache.js","webpack://FakeRest/./node_modules/lodash/_Symbol.js","webpack://FakeRest/./node_modules/lodash/_arrayMap.js","webpack://FakeRest/./node_modules/lodash/_assocIndexOf.js","webpack://FakeRest/./node_modules/lodash/_baseGet.js","webpack://FakeRest/./node_modules/lodash/_baseGetTag.js","webpack://FakeRest/./node_modules/lodash/_baseIsNative.js","webpack://FakeRest/./node_modules/lodash/_baseToString.js","webpack://FakeRest/./node_modules/lodash/_castPath.js","webpack://FakeRest/./node_modules/lodash/_coreJsData.js","webpack://FakeRest/./node_modules/lodash/_freeGlobal.js","webpack://FakeRest/./node_modules/lodash/_getMapData.js","webpack://FakeRest/./node_modules/lodash/_getNative.js","webpack://FakeRest/./node_modules/lodash/_getRawTag.js","webpack://FakeRest/./node_modules/lodash/_getValue.js","webpack://FakeRest/./node_modules/lodash/_hashClear.js","webpack://FakeRest/./node_modules/lodash/_hashDelete.js","webpack://FakeRest/./node_modules/lodash/_hashGet.js","webpack://FakeRest/./node_modules/lodash/_hashHas.js","webpack://FakeRest/./node_modules/lodash/_hashSet.js","webpack://FakeRest/./node_modules/lodash/_isKey.js","webpack://FakeRest/./node_modules/lodash/_isKeyable.js","webpack://FakeRest/./node_modules/lodash/_isMasked.js","webpack://FakeRest/./node_modules/lodash/_listCacheClear.js","webpack://FakeRest/./node_modules/lodash/_listCacheDelete.js","webpack://FakeRest/./node_modules/lodash/_listCacheGet.js","webpack://FakeRest/./node_modules/lodash/_listCacheHas.js","webpack://FakeRest/./node_modules/lodash/_listCacheSet.js","webpack://FakeRest/./node_modules/lodash/_mapCacheClear.js","webpack://FakeRest/./node_modules/lodash/_mapCacheDelete.js","webpack://FakeRest/./node_modules/lodash/_mapCacheGet.js","webpack://FakeRest/./node_modules/lodash/_mapCacheHas.js","webpack://FakeRest/./node_modules/lodash/_mapCacheSet.js","webpack://FakeRest/./node_modules/lodash/_memoizeCapped.js","webpack://FakeRest/./node_modules/lodash/_nativeCreate.js","webpack://FakeRest/./node_modules/lodash/_objectToString.js","webpack://FakeRest/./node_modules/lodash/_root.js","webpack://FakeRest/./node_modules/lodash/_stringToPath.js","webpack://FakeRest/./node_modules/lodash/_toKey.js","webpack://FakeRest/./node_modules/lodash/_toSource.js","webpack://FakeRest/./node_modules/lodash/eq.js","webpack://FakeRest/./node_modules/lodash/get.js","webpack://FakeRest/./node_modules/lodash/isArray.js","webpack://FakeRest/./node_modules/lodash/isFunction.js","webpack://FakeRest/./node_modules/lodash/isObject.js","webpack://FakeRest/./node_modules/lodash/isObjectLike.js","webpack://FakeRest/./node_modules/lodash/isSymbol.js","webpack://FakeRest/./node_modules/lodash/memoize.js","webpack://FakeRest/./node_modules/lodash/toString.js","webpack://FakeRest/webpack/bootstrap","webpack://FakeRest/webpack/runtime/compat get default export","webpack://FakeRest/webpack/runtime/define property getters","webpack://FakeRest/webpack/runtime/global","webpack://FakeRest/webpack/runtime/hasOwnProperty shorthand","webpack://FakeRest/webpack/runtime/make namespace object","webpack://FakeRest/webpack/startup"],"names":["every","array","predicate","reduce","acc","value","some","getArrayOfObjectsPaths","keyParts","item","key","index","undefined","keyToArray","slice","join","keyToItem","itemValue","get","Array","isArray","length","getSimpleFilter","indexOf","realKey","replace","v","filter","filterItems","items","Object","filterFunctions","keys","map","regex","RegExp","q","itemKey","match","split","arrayOfObjectsPaths","arrayPath","valuePath","filteredArrayItems","selected","filterFunction","Error","sortItems","sort","a","b","direction","toLowerCase","rangeItems","range","Collection","identifierName","sequence","server","name","addOne","bind","resourceName","singularResourceName","referenceName","otherCollection","collections","getAll","i","pluralResourceName","getOne","e","embed","resourceNames","resourceEmbedders","endsWith","_oneToManyEmbedder","_manyToOneEmbedder","itemWithEmbeds","embedder","query","assign","_itemEmbedder","identifier","findIndex","getIndex","Math","max","push","splice","Single","obj","parseQueryString","queryString","queryObject","queryElements","queryElement","JSON","parse","trim","Server","baseUrl","loggingEnabled","defaultQuery","batchUrl","singles","requestInterceptors","responseInterceptors","data","addCollection","addSingle","url","console","warn","collection","setServer","setName","single","interceptor","params","getCount","hasOwnProperty","updateOne","removeOne","getOnly","updateOnly","request","decodeURIComponent","requestBody","json","error","previous","current","body","headers","status","response","log","respond","stringify","group","groupCollapsed","method","requestHeaders","groupEnd","handle","jsonResponse","requestName","subResponse","sub","code","headerName","decode","batch","getSingleNames","matches","getCollection","count","contentRange","first","last","min","newResource","newResourceURI","Location","id","FetchServer","opts","req","Request","text","then","requestJson","Headers","reponse","getCollectionNames"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAACC,KAAD,EAAQC,SAAR;AAAA,SACVD,KAAK,CAACE,MAAN,CAAa,UAACC,GAAD,EAAMC,KAAN;AAAA,WAAgBD,GAAG,IAAIF,SAAS,CAACG,KAAD,CAAhC;AAAA,GAAb,EAAsD,IAAtD,CADU;AAAA,CAAd;;AAGA,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAACL,KAAD,EAAQC,SA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AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACjBA,mBAAmB,mBAAO,CAAC,IAAiB;AAC5C,eAAe,mBAAO,CAAC,IAAa;;AAEpC;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AChBA,aAAa,mBAAO,CAAC,IAAW;;AAEhC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC7CA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;;;;;;;;ACZA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AChBA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC7BA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACtBA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACtBA,cAAc,mBAAO,CAAC,IAAW;AACjC,eAAe,mBAAO,CAAC,IAAY;;AAEnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC5BA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACdA,iBAAiB,mBAAO,CAAC,IAAe;;AAExC;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACZA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AClCA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;AClBA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;;ACfA,mBAAmB,mBAAO,CAAC,IAAiB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;;;;;;;ACzBA,WAAW,mBAAO,CAAC,IAAS;AAC5B,gBAAgB,mBAAO,CAAC,IAAc;AACtC,UAAU,mBAAO,CAAC,IAAQ;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACpBA,iBAAiB,mBAAO,CAAC,IAAe;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACjBA,iBAAiB,mBAAO,CAAC,IAAe;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;;;;;;;;ACfA,iBAAiB,mBAAO,CAAC,IAAe;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;;ACfA,iBAAiB,mBAAO,CAAC,IAAe;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;;;;;ACrBA,cAAc,mBAAO,CAAC,IAAW;;AAEjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;;;;;;;;ACzBA,gBAAgB,mBAAO,CAAC,GAAc;;AAEtC;AACA;;AAEA;;;;;;;;ACLA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;;ACrBA,iBAAiB,mBAAO,CAAC,IAAe;;AAExC;AACA;;AAEA;AACA;;AAEA;;;;;;;;ACRA,oBAAoB,mBAAO,CAAC,IAAkB;;AAE9C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;;;;;;;;AC1BA,eAAe,mBAAO,CAAC,IAAY;;AAEnC;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,cAAc;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACpBA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACpCA,cAAc,mBAAO,CAAC,IAAY;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB,WAAW,EAAE;AACb,aAAa,EAAE;AACf;AACA;AACA,iBAAiB,QAAQ,OAAO,SAAS,EAAE;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACzBA,iBAAiB,mBAAO,CAAC,IAAe;AACxC,eAAe,mBAAO,CAAC,IAAY;;AAEnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC5BA,iBAAiB,mBAAO,CAAC,IAAe;AACxC,mBAAmB,mBAAO,CAAC,IAAgB;;AAE3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC5BA,eAAe,mBAAO,CAAC,IAAa;;AAEpC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;ACxEA,mBAAmB,mBAAO,CAAC,GAAiB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;UC3BA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA,cAAc,0BAA0B,EAAE;WAC1C,cAAc,eAAe;WAC7B,gCAAgC,YAAY;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,EAAE;WACF;WACA;WACA,CAAC,I;;;;;WCPD,6CAA6C,wDAAwD,E;;;;;WCArG;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"FakeRest.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FakeRest\"] = factory();\n\telse\n\t\troot[\"FakeRest\"] = factory();\n})(self, function() {\nreturn ","import get from 'lodash/get';\n\nconst every = (array, predicate) =>\n array.reduce((acc, value) => acc && predicate(value), true);\n\nconst some = (array, predicate) =>\n array.reduce((acc, value) => acc || predicate(value), false);\n\nconst getArrayOfObjectsPaths = (keyParts, item) => \n keyParts.reduce((acc, key, index) => {\n // If we already found an array, we don't need to explore further\n // For example with path `tags.name` when tags is an array of objects\n if (acc != undefined) {\n return acc;\n }\n \n let keyToArray = keyParts.slice(0, index + 1).join('.');\n let keyToItem = keyParts.slice(index + 1).join('.')\n let itemValue = get(item, keyToArray);\n \n // If the array is at the end of the key path, we will process it like we do normally with arrays\n // For example with path `deep.tags` where tags is the array. In this case, we return undefined\n return Array.isArray(itemValue) && index < keyParts.length - 1\n ? [keyToArray, keyToItem]\n : undefined;\n }, undefined);\n\nconst getSimpleFilter = (key, value) => {\n if (key.indexOf('_lte') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_lte)$/, '');\n return item => get(item, realKey) <= value;\n }\n if (key.indexOf('_gte') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_gte)$/, '');\n return item => get(item, realKey) >= value;\n }\n if (key.indexOf('_lt') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_lt)$/, '');\n return item => get(item, realKey) < value;\n }\n if (key.indexOf('_gt') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_gt)$/, '');\n return item => get(item, realKey) > value;\n }\n if (Array.isArray(value)) {\n return item => {\n if (Array.isArray(get(item, key))) {\n // array filter and array item value: where all items in values\n return every(\n value,\n v => some(get(item, key), itemValue => itemValue == v)\n );\n }\n // where item in values\n return value.filter(v => v == get(item, key)).length > 0;\n }\n }\n return item => {\n if (Array.isArray(get(item, key)) && typeof value == 'string') {\n // simple filter but array item value: where value in item\n return get(item, key).indexOf(value) !== -1;\n }\n if (typeof get(item, key) == 'boolean' && typeof value == 'string') {\n // simple filter but boolean item value: boolean where\n return get(item, key) == (value === 'true' ? true : false);\n }\n // simple filter\n return get(item, key) == value;\n };\n}\n\nfunction filterItems(items, filter) {\n if (typeof filter === 'function') {\n return items.filter(filter);\n }\n if (filter instanceof Object) {\n // turn filter properties to functions\n var filterFunctions = Object.keys(filter).map(key => {\n if (key === 'q') {\n let regex = new RegExp(filter.q, 'i');\n // full-text filter\n return item => {\n for (let itemKey in item) {\n if (item[itemKey] && item[itemKey].match && item[itemKey].match(regex) !== null) return true;\n }\n return false;\n };\n }\n\n let keyParts = key.split('.');\n let value = filter[key];\n if (keyParts.length > 1) {\n return item => {\n let arrayOfObjectsPaths = getArrayOfObjectsPaths(keyParts, item);\n\n if (arrayOfObjectsPaths) {\n let [arrayPath, valuePath] = arrayOfObjectsPaths;\n // Check wether any item in the array matches the filter\n const filteredArrayItems = filterItems(get(item, arrayPath), {[valuePath]: value});\n return filteredArrayItems.length > 0;\n } else {\n return getSimpleFilter(key, value)(item);\n }\n }\n }\n\n return getSimpleFilter(key, value);\n });\n // only the items matching all filters functions are in (AND logic)\n return items.filter(item =>\n filterFunctions.reduce((selected, filterFunction) => selected && filterFunction(item), true)\n );\n }\n throw new Error('Unsupported filter type');\n}\n\nfunction sortItems(items, sort) {\n if (typeof sort === 'function') {\n return items.sort(sort);\n }\n if (typeof sort === 'string') {\n return items.sort(function(a, b) {\n if (a[sort] > b[sort]) {\n return 1;\n }\n if (a[sort] < b[sort]) {\n return -1;\n }\n return 0;\n });\n }\n if (Array.isArray(sort)) {\n let key = sort[0];\n let direction = sort[1].toLowerCase() == 'asc' ? 1 : -1;\n return items.sort(function(a, b) {\n if (a[key] > b[key]) {\n return direction;\n }\n if (a[key] < b[key]) {\n return -1 * direction ;\n }\n return 0;\n });\n }\n throw new Error('Unsupported sort type');\n}\n\nfunction rangeItems(items, range) {\n if (Array.isArray(range)) {\n return items.slice(range[0], range[1] !== undefined ? range[1] + 1 : undefined);\n }\n throw new Error('Unsupported range type');\n}\n\nexport class Collection {\n\n constructor(items=[], identifierName='id') {\n if (!Array.isArray(items)) {\n throw new Error('Can\\'t initialize a Collection with anything else than an array of items');\n }\n this.sequence = 0; // id of the next item\n this.identifierName = identifierName;\n this.items = [];\n this.server = null;\n this.name = null;\n items.map(this.addOne.bind(this));\n }\n\n /**\n * A Collection may need to access other collections (e.g. for embedding references)\n * This is done through a reference to the parent server.\n */\n setServer(server) {\n this.server = server;\n }\n\n setName(name) {\n this.name = name;\n }\n\n /**\n * Get a one to many embedder function for a given resource name\n *\n * @example embed posts for an author\n *\n * authorsCollection._oneToManyEmbedder('posts')\n *\n * @returns Function item => item\n */\n _oneToManyEmbedder(resourceName) {\n const singularResourceName = this.name.slice(0,-1);\n const referenceName = singularResourceName + '_id';\n return (item) => {\n const otherCollection = this.server.collections[resourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n if (Array.isArray(item[resourceName])) {\n // the many to one relationship is carried by an array of ids, e.g. { posts: [1, 2] } in authors\n item[resourceName] = otherCollection.getAll({\n filter: i => item[resourceName].indexOf(i[otherCollection.identifierName]) !== -1\n });\n } else {\n // the many to one relationship is carried by references in the related collection, e.g. { author_id: 1 } in posts\n item[resourceName] = otherCollection.getAll({\n filter: i => i[referenceName] == item[this.identifierName]\n });\n }\n return item;\n };\n }\n\n /**\n * Get a many to one embedder function for a given resource name\n *\n * @example embed author for a post\n *\n * postsCollection._manyToOneEmbedder('author')\n *\n * @returns Function item => item\n */\n _manyToOneEmbedder(resourceName) {\n const pluralResourceName = resourceName + 's';\n const referenceName = resourceName + '_id';\n return (item) => {\n const otherCollection = this.server.collections[pluralResourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n try {\n item[resourceName] = otherCollection.getOne(item[referenceName]);\n } catch (e) {\n // resource doesn't exist in the related collection - do not embed\n }\n return item;\n };\n }\n\n /**\n * @param String[] An array of resource names, e.g. ['books', 'country']\n * @returns Function item => item\n */\n _itemEmbedder(embed) {\n const resourceNames = Array.isArray(embed) ? embed : [embed];\n const resourceEmbedders = resourceNames.map(resourceName =>\n resourceName.endsWith('s') ? this._oneToManyEmbedder(resourceName) : this._manyToOneEmbedder(resourceName)\n );\n return item => resourceEmbedders.reduce((itemWithEmbeds, embedder) => embedder(itemWithEmbeds), item);\n }\n\n getCount(query) {\n return this.getAll(query).length;\n }\n\n getAll(query) {\n var items = this.items.slice(0); // clone the array to avoid updating the core one\n if (query) {\n if (query.filter) {\n items = filterItems(items, query.filter);\n }\n if (query.sort) {\n items = sortItems(items, query.sort);\n }\n if (query.range) {\n items = rangeItems(items, query.range);\n }\n items = items.map(item => Object.assign({}, item)) // clone item to avoid returning the original\n if (query.embed && this.server) {\n items = items.map(this._itemEmbedder(query.embed)); // embed reference\n }\n }\n return items;\n }\n\n getIndex(identifier) {\n return this.items.findIndex(item => item[this.identifierName] == identifier);\n }\n\n getOne(identifier, query) {\n let index = this.getIndex(identifier);\n if (index === -1) {\n throw new Error(`No item with identifier ${ identifier }`);\n }\n let item = this.items[index];\n item = Object.assign({}, item); // clone item to avoid returning the original\n if (query && query.embed && this.server) {\n item = this._itemEmbedder(query.embed)(item); // embed reference\n }\n return item;\n }\n\n addOne(item) {\n var identifier = item[this.identifierName];\n if (identifier !== undefined) {\n if (this.getIndex(identifier) !== -1) {\n throw new Error(`An item with the identifier ${ identifier } already exists`);\n } else {\n this.sequence = Math.max(this.sequence, identifier) + 1;\n }\n } else {\n item[this.identifierName] = this.sequence++;\n }\n this.items.push(item);\n return Object.assign({}, item); // clone item to avoid returning the original;\n }\n\n updateOne(identifier, item) {\n let index = this.getIndex(identifier);\n if (index === -1) {\n throw new Error(`No item with identifier ${ identifier }`);\n }\n for (let key in item) {\n this.items[index][key] = item[key];\n }\n return Object.assign({}, this.items[index]); // clone item to avoid returning the original\n }\n\n removeOne(identifier) {\n let index = this.getIndex(identifier);\n if (index === -1) {\n throw new Error(`No item with identifier ${ identifier }`);\n }\n var item = this.items[index];\n this.items.splice(index, 1);\n if (identifier == (this.sequence - 1)) {\n this.sequence--;\n }\n return item;\n }\n}\n","export class Single {\n constructor(obj) {\n if (!(obj instanceof Object)) {\n throw new Error('Can\\'t initialize a Single with anything except an object');\n }\n this.obj = obj;\n this.server = null;\n this.name = null;\n }\n\n /**\n * A Single may need to access other collections (e.g. for embedded\n * references) This is done through a reference to the parent server.\n */\n setServer(server) {\n this.server = server;\n }\n\n setName(name) {\n this.name = name;\n }\n\n // No need to embed Singles, since they are by their nature top-level\n // No need to worry about remote references, (i.e. mysingleton_id=1) since\n // it is by definition a singleton\n _oneToManyEmbedder(resourceName) {\n return (item) => {\n const otherCollection = this.server.collections[resourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n // We have an array of ids {posts: [1,2]} (back refs are not valid\n // for singleton)\n item[resourceName] = otherCollection.getAll({\n filter: i => item[resourceName].indexOf(i[otherCollection.identifierName]) !== -1\n });\n return item;\n }; \n }\n\n _manyToOneEmbedder(resourceName) {\n const pluralResourceName = resourceName + 's';\n const referenceName = resourceName + '_id';\n return (item) => {\n const otherCollection = this.server.collections[pluralResourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n try {\n item[resourceName] = otherCollection.getOne(item[referenceName]);\n } catch (e) {\n // Resource doesn't exist, so don't embed\n }\n return item;\n };\n }\n\n _itemEmbedder(embed) {\n const resourceNames = Array.isArray(embed) ? embed : [embed];\n const resourceEmbedders = resourceNames.map(resourceName =>\n resourceName.endsWith('s') ? this._oneToManyEmbedder(resourceName) : this._manyToOneEmbedder(resourceName)\n );\n return item => resourceEmbedders.reduce((itemWithEmbeds, embedder) => embedder(itemWithEmbeds), item);\n }\n\n getOnly(query) {\n let item = this.obj;\n if (query && query.embed && this.server) {\n item = Object.assign({}, item); // Clone\n item = this._itemEmbedder(query.embed)(item);\n }\n return item;\n }\n\n updateOnly(item) {\n for (let key in item) {\n this.obj[key] = item[key];\n }\n return this.obj;\n }\n}\n","export function parseQueryString(queryString) {\n if (!queryString) {\n return {};\n }\n let queryObject = {};\n let queryElements = queryString.split('&');\n\n queryElements.map(function(queryElement) {\n if (queryElement.indexOf('=') === -1) {\n queryObject[queryElement] = true;\n } else {\n let [key, value] = queryElement.split('=');\n if (value.indexOf('[') === 0 || value.indexOf('{') === 0) {\n value = JSON.parse(value);\n }\n queryObject[key.trim()] = value;\n }\n });\n\n return queryObject;\n}\n","import { Collection } from './Collection';\nimport { Single } from './Single';\nimport { parseQueryString } from './parseQueryString';\n\nexport class Server {\n constructor(baseUrl='') {\n this.baseUrl = baseUrl;\n this.loggingEnabled = false;\n this.defaultQuery = () => {};\n this.batchUrl = null;\n this.collections = {};\n this.singles = {};\n this.requestInterceptors = [];\n this.responseInterceptors = [];\n }\n\n /**\n * Shortcut for adding several collections if identifierName is always 'id'\n */\n init(data) {\n for (let name in data) {\n if (Array.isArray(data[name])) {\n this.addCollection(name, new Collection(data[name], 'id'));\n } else {\n this.addSingle(name, new Single(data[name]));\n }\n }\n }\n\n toggleLogging() {\n this.loggingEnabled = !this.loggingEnabled;\n }\n\n /**\n * @param Function ResourceName => object\n */\n setDefaultQuery(query) {\n this.defaultQuery = query;\n }\n\n setBatchUrl(batchUrl) {\n this.batchUrl = batchUrl;\n }\n\n /**\n * @deprecated use setBatchUrl instead\n */\n setBatch(url) {\n console.warn('Server.setBatch() is deprecated, use Server.setBatchUrl() instead');\n this.batchUrl = url;\n }\n\n addCollection(name, collection) {\n this.collections[name] = collection;\n collection.setServer(this);\n collection.setName(name);\n }\n\n getCollection(name) {\n return this.collections[name];\n }\n\n getCollectionNames() {\n return Object.keys(this.collections);\n }\n\n addSingle(name, single) {\n this.singles[name] = single;\n single.setServer(this);\n single.setName(name);\n }\n\n getSingle(name) {\n return this.singles[name];\n }\n\n getSingleNames() {\n return Object.keys(this.singles);\n }\n\n addRequestInterceptor(interceptor) {\n this.requestInterceptors.push(interceptor);\n }\n\n addResponseInterceptor(interceptor) {\n this.responseInterceptors.push(interceptor);\n }\n\n /**\n * @param {string} name\n * @param {string} params As decoded from the query string, e.g. { sort: \"name\", filter: {enabled:true}, slice: [10, 20] }\n */\n getCount(name, params) {\n return this.collections[name].getCount(params);\n }\n\n /**\n * @param {string} name\n * @param {string} params As decoded from the query string, e.g. { sort: \"name\", filter: {enabled:true}, slice: [10, 20] }\n */\n getAll(name, params) {\n return this.collections[name].getAll(params);\n }\n\n getOne(name, identifier, params) {\n return this.collections[name].getOne(identifier, params);\n }\n\n addOne(name, item) {\n if (!this.collections.hasOwnProperty(name)) {\n this.addCollection(name, new Collection([], 'id'));\n }\n return this.collections[name].addOne(item);\n }\n\n updateOne(name, identifier, item) {\n return this.collections[name].updateOne(identifier, item);\n }\n\n removeOne(name, identifier) {\n return this.collections[name].removeOne(identifier);\n }\n\n getOnly(name, params) {\n return this.singles[name].getOnly();\n }\n\n updateOnly(name, item) {\n return this.singles[name].updateOnly(item);\n }\n\n\n decode(request) {\n request.queryString = decodeURIComponent(request.url.slice(request.url.indexOf('?') + 1));\n request.params = parseQueryString(request.queryString);\n if (request.requestBody) {\n try {\n request.json = JSON.parse(request.requestBody);\n } catch(error) {\n // body isn't JSON, skipping\n }\n }\n return this.requestInterceptors.reduce(function(previous, current) {\n return current(previous);\n }, request);\n }\n\n respond(body, headers, request, status=200) {\n if (!headers) {\n headers = {};\n }\n if (!headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n let response = { status: status, headers: headers, body: body };\n response = this.responseInterceptors.reduce(function(previous, current) {\n return current(previous, request);\n }, response);\n this.log(request, response);\n\n return request.respond(response.status, response.headers, JSON.stringify(response.body));\n }\n\n log(request, response) {\n if (!this.loggingEnabled) return;\n if (console.group) {\n // Better logging in Chrome\n console.groupCollapsed(request.method, request.url, '(FakeRest)');\n console.group('request');\n console.log(request.method, request.url);\n console.log('headers', request.requestHeaders);\n console.log('body ', request.requestBody);\n console.groupEnd();\n console.group('response', response.status);\n console.log('headers', response.headers);\n console.log('body ', response.body);\n console.groupEnd();\n console.groupEnd();\n } else {\n console.log('FakeRest request ', request.method, request.url, 'headers', request.requestHeaders, 'body', request.requestBody);\n console.log('FakeRest response', response.status, 'headers', response.headers, 'body', response.body);\n }\n }\n\n batch(request) {\n\n var json = request.json;\n var handle = this.handle.bind(this);\n\n var jsonResponse = Object.keys(json).reduce(function (jsonResponse, requestName) {\n var subResponse;\n var sub = {\n url: json[requestName],\n method: 'GET',\n params: {},\n respond: function (code, headers, body) {\n subResponse = {\n code: code,\n headers: Object.keys(headers || {}).map(function (headerName) {\n return {\n 'name': headerName,\n 'value': headers[headerName]\n };\n }),\n body: body || {}\n };\n }\n };\n handle(sub);\n\n jsonResponse[requestName] = subResponse || {\n code: 404,\n headers: [],\n body: {}\n };\n\n return jsonResponse;\n }, {});\n\n return this.respond(jsonResponse, {}, request, 200);\n }\n\n /**\n * @param {FakeXMLHttpRequest} request\n *\n * String request.url The URL set on the request object.\n * String request.method The request method as a string.\n * Object request.requestHeaders An object of all request headers, i.e.:\n * {\n * \"Accept\": \"text/html\",\n * \"Connection\": \"keep-alive\"\n * }\n * String request.requestBody The request body\n * String request.username Username, if any.\n * String request.password Password, if any.\n */\n handle(request) {\n request = this.decode(request);\n\n if (this.batchUrl && this.batchUrl === request.url && request.method === 'POST') {\n return this.batch(request);\n }\n\n // Handle Single Objects\n for (let name of this.getSingleNames()) {\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/(' + name + ')(\\\\/?.*)?$' ));\n if (!matches) continue;\n\n if (request.method == 'GET') {\n try {\n let item = this.getOnly(name);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PUT') {\n try {\n let item = this.updateOnly(name, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PATCH') {\n try {\n let item = this.updateOnly(name, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n }\n\n // Handle collections\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/([^\\\\/?]+)(\\\\/(\\\\d+))?(\\\\?.*)?$' ));\n if (!matches) return;\n let name = matches[1];\n let params = Object.assign({}, this.defaultQuery(name), request.params);\n if (!matches[2]) {\n if (request.method == 'GET') {\n if (!this.getCollection(name)) {\n return;\n }\n let count = this.getCount(name, params.filter ? { filter: params.filter } : {});\n let items, contentRange, status;\n if (count > 0) {\n items = this.getAll(name, params);\n let first = params.range ? params.range[0] : 0;\n let last = params.range ? Math.min(items.length - 1 + first, params.range[1]) : (items.length - 1);\n contentRange = `items ${first}-${last}/${count}`;\n status = (items.length == count) ? 200 : 206;\n } else {\n items = [];\n contentRange = 'items */0';\n status = 200;\n }\n return this.respond(items, { 'Content-Range': contentRange }, request, status);\n }\n if (request.method == 'POST') {\n let newResource = this.addOne(name, request.json);\n let newResourceURI = this.baseUrl + '/' + name + '/' + newResource[this.getCollection(name).identifierName];\n return this.respond(newResource, { Location: newResourceURI }, request, 201);\n }\n } else {\n if (!this.getCollection(name)) {\n return;\n }\n let id = matches[3];\n if (request.method == 'GET') {\n try {\n let item = this.getOne(name, id, params);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PUT') {\n try {\n let item = this.updateOne(name, id, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PATCH') {\n try {\n let item = this.updateOne(name, id, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'DELETE') {\n try {\n let item = this.removeOne(name, id);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n }\n }\n\n getHandler() {\n return this.handle.bind(this);\n }\n}\n","import { Server } from './Server';\nimport { parseQueryString } from './parseQueryString';\n\nexport class FetchServer extends Server {\n decode(request, opts) {\n const req = (typeof request === 'string') ? new Request(request, opts) : request;\n req.queryString = decodeURIComponent(req.url.slice(req.url.indexOf('?') + 1));\n req.params = parseQueryString(req.queryString);\n return req.text()\n .then(text => {\n req.requestBody = text\n try {\n req.requestJson = JSON.parse(text)\n } catch(e) {\n // not JSON, no big deal\n }\n })\n .then(() => this.requestInterceptors.reduce((previous, current) => current(previous), req))\n }\n\n respond(response, request) {\n response = this.responseInterceptors.reduce(function(previous, current) {\n return current(previous, request);\n }, response);\n this.log(request, response);\n response.headers = new Headers(response.headers)\n\n return response;\n }\n\n log(request, response) {\n if (!this.loggingEnabled) return;\n if (console.group) {\n // Better logging in Chrome\n console.groupCollapsed(request.method, request.url, '(FakeRest)');\n console.group('request');\n console.log(request.method, request.url);\n console.log('headers', request.headers);\n console.log('body ', request.requestBody);\n console.groupEnd();\n console.group('response', response.status);\n console.log('headers', response.headers);\n console.log('body ', response.body);\n console.groupEnd();\n console.groupEnd();\n } else {\n console.log('FakeRest request ', request.method, request.url, 'headers', request.headers, 'body', request.requestBody);\n console.log('FakeRest response', response.status, 'headers', response.headers, 'body', response.body);\n }\n }\n\n batch(request) {\n throw new Error('not implemented');\n }\n\n /**\n * @param {Request} fetch request\n * @param {Object} options\n *\n */\n handle(req, opts) {\n return this.decode(req, opts)\n .then(request => {\n const response = {\n headers: {'Content-Type': 'application/json' },\n status: 200,\n };\n\n // handle batch request\n if (this.batchUrl && this.batchUrl === request.url && request.method === 'POST') {\n return this.batch(request);\n }\n\n // Handle Single Objects\n for (let name of this.getSingleNames()) {\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/(' + name + ')(\\\\/?.*)?$' ));\n if (!matches) continue;\n\n if (request.method == 'GET') {\n try {\n response.body = this.getOnly(name);\n } catch (error) {\n reponse.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PUT') {\n try {\n response.body = this.updateOnly(name, request.requestJson);\n } catch (error) {\n reponse.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PATCH') {\n try {\n response.body = this.updateOnly(name, request.requestJson);\n } catch (error) {\n reponse.status = 404;\n }\n return this.respond(response, request);\n }\n }\n\n // handle collections\n for (let name of this.getCollectionNames()) {\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/(' + name + ')(\\\\/(\\\\d+))?(\\\\?.*)?$' ));\n if (!matches) continue;\n let params = Object.assign({}, this.defaultQuery(name), request.params);\n if (!matches[2]) {\n if (request.method == 'GET') {\n let count = this.getCount(name, params.filter ? { filter: params.filter } : {});\n if (count > 0) {\n let items = this.getAll(name, params);\n let first = params.range ? params.range[0] : 0;\n let last = params.range ? Math.min(items.length - 1 + first, params.range[1]) : (items.length - 1);\n response.body = items;\n response.headers['Content-Range'] = `items ${first}-${last}/${count}`;\n response.status = (items.length == count) ? 200 : 206;\n } else {\n response.body = [];\n response.headers['Content-Range'] = 'items */0';\n }\n return this.respond(response, request);\n }\n if (request.method == 'POST') {\n let newResource = this.addOne(name, request.requestJson);\n let newResourceURI = this.baseUrl + '/' + name + '/' + newResource[this.getCollection(name).identifierName];\n response.body = newResource;\n response.headers['Location'] = newResourceURI;\n response.status = 201;\n return this.respond(response, request);\n }\n } else {\n let id = matches[3];\n if (request.method == 'GET') {\n try {\n response.body = this.getOne(name, id, params);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PUT') {\n try {\n response.body = this.updateOne(name, id, request.requestJson);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PATCH') {\n try {\n response.body = this.updateOne(name, id, request.requestJson);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'DELETE') {\n try {\n response.body = this.removeOne(name, id);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n }\n }\n return this.respond(response, request);\n });\n }\n}\n","import { Server } from './Server';\nimport { FetchServer } from './FetchServer';\nimport { Collection } from './Collection';\nimport { Single } from './Single';\n\nexport { Server, FetchServer, Collection, Single };\nexport default { Server, FetchServer, Collection, Single };\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(6499);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/FakeRest.min.js b/dist/FakeRest.min.js deleted file mode 100644 index 9a379a6..0000000 --- a/dist/FakeRest.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FakeRest=t():e.FakeRest=t()}(self,(function(){return function(){var e={6499:function(e,t,n){"use strict";n.r(t),n.d(t,{Collection:function(){return f},FetchServer:function(){return q},Server:function(){return _},Single:function(){return d},default:function(){return P}});var r=n(7361),o=n.n(r);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t}}if(-1!==e.indexOf("_lt")){var i=e.replace(/(_lt)$/,"");return function(e){return o()(e,i)t}}return Array.isArray(t)?function(n){return Array.isArray(o()(n,e))?(r=function(t){return r=o()(n,e),i=function(e){return e==t},r.reduce((function(e,t){return e||i(t)}),!1);var r,i},t.reduce((function(e,t){return e&&r(t)}),!0)):t.filter((function(t){return t==o()(n,e)})).length>0;var r}:function(n){return Array.isArray(o()(n,e))&&"string"==typeof t?-1!==o()(n,e).indexOf(t):"boolean"==typeof o()(n,e)&&"string"==typeof t?o()(n,e)==("true"===t):o()(n,e)==t}};function l(e,t){if("function"==typeof t)return e.filter(t);if(t instanceof Object){var n=Object.keys(t).map((function(e){if("q"===e){var n=new RegExp(t.q,"i");return function(e){for(var t in e)if(e[t]&&e[t].match&&null!==e[t].match(n))return!0;return!1}}var r=e.split("."),i=t[e];return r.length>1?function(t){var n=function(e,t){return e.reduce((function(n,r,i){if(null!=n)return n;var u=e.slice(0,i+1).join("."),a=e.slice(i+1).join("."),s=o()(t,u);return Array.isArray(s)&&i0}return c(e,i)(t)}:c(e,i)}));return e.filter((function(e){return n.reduce((function(t,n){return t&&n(e)}),!0)}))}throw new Error("Unsupported filter type")}var f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id";if(i(this,e),!Array.isArray(t))throw new Error("Can't initialize a Collection with anything else than an array of items");this.sequence=0,this.identifierName=n,this.items=[],this.server=null,this.name=null,t.map(this.addOne.bind(this))}var t,n,r;return t=e,(n=[{key:"setServer",value:function(e){this.server=e}},{key:"setName",value:function(e){this.name=e}},{key:"_oneToManyEmbedder",value:function(e){var t=this,n=this.name.slice(0,-1)+"_id";return function(r){var o=t.server.collections[e];if(!o)throw new Error("Can't embed a non-existing collection ".concat(e));return Array.isArray(r[e])?r[e]=o.getAll({filter:function(t){return-1!==r[e].indexOf(t[o.identifierName])}}):r[e]=o.getAll({filter:function(e){return e[n]==r[t.identifierName]}}),r}}},{key:"_manyToOneEmbedder",value:function(e){var t=this,n=e+"s",r=e+"_id";return function(o){var i=t.server.collections[n];if(!i)throw new Error("Can't embed a non-existing collection ".concat(e));try{o[e]=i.getOne(o[r])}catch(e){}return o}}},{key:"_itemEmbedder",value:function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){return e.endsWith("s")?t._oneToManyEmbedder(e):t._manyToOneEmbedder(e)}));return function(e){return n.reduce((function(e,t){return t(e)}),e)}}},{key:"getCount",value:function(e){return this.getAll(e).length}},{key:"getAll",value:function(e){var t=this.items.slice(0);return e&&(e.filter&&(t=l(t,e.filter)),e.sort&&(t=function(e,t){if("function"==typeof t)return e.sort(t);if("string"==typeof t)return e.sort((function(e,n){return e[t]>n[t]?1:e[t]t[n]?r:e[n]e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){a=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw i}}}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"";m(this,e),this.baseUrl=t,this.loggingEnabled=!1,this.defaultQuery=function(){},this.batchUrl=null,this.collections={},this.singles={},this.requestInterceptors=[],this.responseInterceptors=[]}var t,n,r;return t=e,(n=[{key:"init",value:function(e){for(var t in e)Array.isArray(e[t])?this.addCollection(t,new f(e[t],"id")):this.addSingle(t,new d(e[t]))}},{key:"toggleLogging",value:function(){this.loggingEnabled=!this.loggingEnabled}},{key:"setDefaultQuery",value:function(e){this.defaultQuery=e}},{key:"setBatchUrl",value:function(e){this.batchUrl=e}},{key:"setBatch",value:function(e){console.warn("Server.setBatch() is deprecated, use Server.setBatchUrl() instead"),this.batchUrl=e}},{key:"addCollection",value:function(e,t){this.collections[e]=t,t.setServer(this),t.setName(e)}},{key:"getCollection",value:function(e){return this.collections[e]}},{key:"getCollectionNames",value:function(){return Object.keys(this.collections)}},{key:"addSingle",value:function(e,t){this.singles[e]=t,t.setServer(this),t.setName(e)}},{key:"getSingle",value:function(e){return this.singles[e]}},{key:"getSingleNames",value:function(){return Object.keys(this.singles)}},{key:"addRequestInterceptor",value:function(e){this.requestInterceptors.push(e)}},{key:"addResponseInterceptor",value:function(e){this.responseInterceptors.push(e)}},{key:"getCount",value:function(e,t){return this.collections[e].getCount(t)}},{key:"getAll",value:function(e,t){return this.collections[e].getAll(t)}},{key:"getOne",value:function(e,t,n){return this.collections[e].getOne(t,n)}},{key:"addOne",value:function(e,t){return this.collections.hasOwnProperty(e)||this.addCollection(e,new f([],"id")),this.collections[e].addOne(t)}},{key:"updateOne",value:function(e,t,n){return this.collections[e].updateOne(t,n)}},{key:"removeOne",value:function(e,t){return this.collections[e].removeOne(t)}},{key:"getOnly",value:function(e,t){return this.singles[e].getOnly()}},{key:"updateOnly",value:function(e,t){return this.singles[e].updateOnly(t)}},{key:"decode",value:function(e){if(e.queryString=decodeURIComponent(e.url.slice(e.url.indexOf("?")+1)),e.params=v(e.queryString),e.requestBody)try{e.json=JSON.parse(e.requestBody)}catch(e){}return this.requestInterceptors.reduce((function(e,t){return t(e)}),e)}},{key:"respond",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;t||(t={}),t["Content-Type"]||(t["Content-Type"]="application/json");var o={status:r,headers:t,body:e};return o=this.responseInterceptors.reduce((function(e,t){return t(e,n)}),o),this.log(n,o),n.respond(o.status,o.headers,JSON.stringify(o.body))}},{key:"log",value:function(e,t){this.loggingEnabled&&(console.group?(console.groupCollapsed(e.method,e.url,"(FakeRest)"),console.group("request"),console.log(e.method,e.url),console.log("headers",e.requestHeaders),console.log("body ",e.requestBody),console.groupEnd(),console.group("response",t.status),console.log("headers",t.headers),console.log("body ",t.body),console.groupEnd(),console.groupEnd()):(console.log("FakeRest request ",e.method,e.url,"headers",e.requestHeaders,"body",e.requestBody),console.log("FakeRest response",t.status,"headers",t.headers,"body",t.body)))}},{key:"batch",value:function(e){var t=e.json,n=this.handle.bind(this),r=Object.keys(t).reduce((function(e,r){var o,i={url:t[r],method:"GET",params:{},respond:function(e,t,n){o={code:e,headers:Object.keys(t||{}).map((function(e){return{name:e,value:t[e]}})),body:n||{}}}};return n(i),e[r]=o||{code:404,headers:[],body:{}},e}),{});return this.respond(r,{},e,200)}},{key:"handle",value:function(e){if(e=this.decode(e),this.batchUrl&&this.batchUrl===e.url&&"POST"===e.method)return this.batch(e);var t,n=g(this.getSingleNames());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e.url.match(new RegExp("^"+this.baseUrl+"\\/("+r+")(\\/?.*)?$"))){if("GET"==e.method)try{var o=this.getOnly(r);return this.respond(o,null,e)}catch(t){return e.respond(404)}if("PUT"==e.method)try{var i=this.updateOnly(r,e.json);return this.respond(i,null,e)}catch(t){return e.respond(404)}if("PATCH"==e.method)try{var u=this.updateOnly(r,e.json);return this.respond(u,null,e)}catch(t){return e.respond(404)}}}}catch(e){n.e(e)}finally{n.f()}var a=e.url.match(new RegExp("^"+this.baseUrl+"\\/([^\\/?]+)(\\/(\\d+))?(\\?.*)?$"));if(a){var s=a[1],c=Object.assign({},this.defaultQuery(s),e.params);if(a[2]){if(!this.getCollection(s))return;var l=a[3];if("GET"==e.method)try{var f=this.getOne(s,l,c);return this.respond(f,null,e)}catch(t){return e.respond(404)}if("PUT"==e.method)try{var h=this.updateOne(s,l,e.json);return this.respond(h,null,e)}catch(t){return e.respond(404)}if("PATCH"==e.method)try{var d=this.updateOne(s,l,e.json);return this.respond(d,null,e)}catch(t){return e.respond(404)}if("DELETE"==e.method)try{var p=this.removeOne(s,l);return this.respond(p,null,e)}catch(t){return e.respond(404)}}else{if("GET"==e.method){if(!this.getCollection(s))return;var y,v,b,m=this.getCount(s,c.filter?{filter:c.filter}:{});if(m>0){y=this.getAll(s,c);var O=c.range?c.range[0]:0,_=c.range?Math.min(y.length-1+O,c.range[1]):y.length-1;v="items ".concat(O,"-").concat(_,"/").concat(m),b=y.length==m?200:206}else y=[],v="items */0",b=200;return this.respond(y,{"Content-Range":v},e,b)}if("POST"==e.method){var w=this.addOne(s,e.json),x=this.baseUrl+"/"+s+"/"+w[this.getCollection(s).identifierName];return this.respond(w,{Location:x},e,201)}}}}},{key:"getHandler",value:function(){return this.handle.bind(this)}}])&&O(t.prototype,n),r&&O(t,r),e}();function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){a=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw i}}}}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var d=n.getAll(s,l),p=l.range?l.range[0]:0,y=l.range?Math.min(d.length-1+p,l.range[1]):d.length-1;t.body=d,t.headers["Content-Range"]="items ".concat(p,"-").concat(y,"/").concat(h),t.status=d.length==h?200:206}else t.body=[],t.headers["Content-Range"]="items */0";return n.respond(t,e)}if("POST"==e.method){var v=n.addOne(s,e.requestJson),g=n.baseUrl+"/"+s+"/"+v[n.getCollection(s).identifierName];return t.body=v,t.headers.Location=g,t.status=201,n.respond(t,e)}}}}}catch(e){a.e(e)}finally{a.f()}return n.respond(t,e)}))}}])&&k(t.prototype,n),r&&k(t,r),i}(_),P={Server:_,FetchServer:q,Collection:f,Single:d}},1989:function(e,t,n){var r=n(1789),o=n(401),i=n(7667),u=n(1327),a=n(1866);function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1}},4705:function(e,t,n){var r=n(8470);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},4785:function(e,t,n){var r=n(1989),o=n(8407),i=n(7071);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},1285:function(e,t,n){var r=n(5050);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},6e3:function(e,t,n){var r=n(5050);e.exports=function(e){return r(this,e).get(e)}},9916:function(e,t,n){var r=n(5050);e.exports=function(e){return r(this,e).has(e)}},5265:function(e,t,n){var r=n(5050);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},4523:function(e,t,n){var r=n(8306);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},4536:function(e,t,n){var r=n(852)(Object,"create");e.exports=r},2333:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5639:function(e,t,n){var r=n(1957),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},5514:function(e,t,n){var r=n(4523),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,u=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=u},327:function(e,t,n){var r=n(3448);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}},346:function(e){var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},7813:function(e){e.exports=function(e,t){return e===t||e!=e&&t!=t}},7361:function(e,t,n){var r=n(7786);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},1469:function(e){var t=Array.isArray;e.exports=t},3560:function(e,t,n){var r=n(4239),o=n(3218);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},3218:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},7005:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},3448:function(e,t,n){var r=n(4239),o=n(7005);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},8306:function(e,t,n){var r=n(3369);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var u=e.apply(this,r);return n.cache=i.set(o,u)||i,u};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},9833:function(e,t,n){var r=n(531);e.exports=function(e){return null==e?"":r(e)}}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}return n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(6499)}()})); -//# sourceMappingURL=FakeRest.min.js.map \ No newline at end of file diff --git a/dist/FakeRest.min.js.map b/dist/FakeRest.min.js.map deleted file mode 100644 index 961ebe5..0000000 --- a/dist/FakeRest.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://FakeRest/webpack/universalModuleDefinition","webpack://FakeRest/./src/Collection.js","webpack://FakeRest/./src/Single.js","webpack://FakeRest/./src/parseQueryString.js","webpack://FakeRest/./src/Server.js","webpack://FakeRest/./src/FetchServer.js","webpack://FakeRest/./src/FakeRest.js","webpack://FakeRest/./node_modules/lodash/_Hash.js","webpack://FakeRest/./node_modules/lodash/_ListCache.js","webpack://FakeRest/./node_modules/lodash/_Map.js","webpack://FakeRest/./node_modules/lodash/_MapCache.js","webpack://FakeRest/./node_modules/lodash/_Symbol.js","webpack://FakeRest/./node_modules/lodash/_arrayMap.js","webpack://FakeRest/./node_modules/lodash/_assocIndexOf.js","webpack://FakeRest/./node_modules/lodash/_baseGet.js","webpack://FakeRest/./node_modules/lodash/_baseGetTag.js","webpack://FakeRest/./node_modules/lodash/_baseIsNative.js","webpack://FakeRest/./node_modules/lodash/_baseToString.js","webpack://FakeRest/./node_modules/lodash/_castPath.js","webpack://FakeRest/./node_modules/lodash/_coreJsData.js","webpack://FakeRest/./node_modules/lodash/_freeGlobal.js","webpack://FakeRest/./node_modules/lodash/_getMapData.js","webpack://FakeRest/./node_modules/lodash/_getNative.js","webpack://FakeRest/./node_modules/lodash/_getRawTag.js","webpack://FakeRest/./node_modules/lodash/_getValue.js","webpack://FakeRest/./node_modules/lodash/_hashClear.js","webpack://FakeRest/./node_modules/lodash/_hashDelete.js","webpack://FakeRest/./node_modules/lodash/_hashGet.js","webpack://FakeRest/./node_modules/lodash/_hashHas.js","webpack://FakeRest/./node_modules/lodash/_hashSet.js","webpack://FakeRest/./node_modules/lodash/_isKey.js","webpack://FakeRest/./node_modules/lodash/_isKeyable.js","webpack://FakeRest/./node_modules/lodash/_isMasked.js","webpack://FakeRest/./node_modules/lodash/_listCacheClear.js","webpack://FakeRest/./node_modules/lodash/_listCacheDelete.js","webpack://FakeRest/./node_modules/lodash/_listCacheGet.js","webpack://FakeRest/./node_modules/lodash/_listCacheHas.js","webpack://FakeRest/./node_modules/lodash/_listCacheSet.js","webpack://FakeRest/./node_modules/lodash/_mapCacheClear.js","webpack://FakeRest/./node_modules/lodash/_mapCacheDelete.js","webpack://FakeRest/./node_modules/lodash/_mapCacheGet.js","webpack://FakeRest/./node_modules/lodash/_mapCacheHas.js","webpack://FakeRest/./node_modules/lodash/_mapCacheSet.js","webpack://FakeRest/./node_modules/lodash/_memoizeCapped.js","webpack://FakeRest/./node_modules/lodash/_nativeCreate.js","webpack://FakeRest/./node_modules/lodash/_objectToString.js","webpack://FakeRest/./node_modules/lodash/_root.js","webpack://FakeRest/./node_modules/lodash/_stringToPath.js","webpack://FakeRest/./node_modules/lodash/_toKey.js","webpack://FakeRest/./node_modules/lodash/_toSource.js","webpack://FakeRest/./node_modules/lodash/eq.js","webpack://FakeRest/./node_modules/lodash/get.js","webpack://FakeRest/./node_modules/lodash/isArray.js","webpack://FakeRest/./node_modules/lodash/isFunction.js","webpack://FakeRest/./node_modules/lodash/isObject.js","webpack://FakeRest/./node_modules/lodash/isObjectLike.js","webpack://FakeRest/./node_modules/lodash/isSymbol.js","webpack://FakeRest/./node_modules/lodash/memoize.js","webpack://FakeRest/./node_modules/lodash/toString.js","webpack://FakeRest/webpack/bootstrap","webpack://FakeRest/webpack/startup","webpack://FakeRest/webpack/runtime/compat get default export","webpack://FakeRest/webpack/runtime/define property getters","webpack://FakeRest/webpack/runtime/global","webpack://FakeRest/webpack/runtime/hasOwnProperty shorthand","webpack://FakeRest/webpack/runtime/make namespace object"],"names":["root","factory","exports","module","define","amd","self","getSimpleFilter","key","value","indexOf","realKey","replace","item","get","Array","isArray","predicate","v","array","itemValue","reduce","acc","filter","length","filterItems","items","Object","filterFunctions","keys","map","regex","RegExp","q","itemKey","match","keyParts","split","arrayOfObjectsPaths","index","undefined","keyToArray","slice","join","keyToItem","getArrayOfObjectsPaths","arrayPath","valuePath","selected","filterFunction","Error","Collection","identifierName","this","sequence","server","name","addOne","bind","resourceName","referenceName","otherCollection","collections","getAll","i","pluralResourceName","getOne","e","embed","resourceEmbedders","endsWith","_oneToManyEmbedder","_manyToOneEmbedder","itemWithEmbeds","embedder","query","sort","a","b","direction","toLowerCase","sortItems","range","rangeItems","assign","_itemEmbedder","identifier","findIndex","getIndex","Math","max","push","splice","Single","obj","parseQueryString","queryString","queryObject","queryElement","JSON","parse","trim","Server","baseUrl","loggingEnabled","defaultQuery","batchUrl","singles","requestInterceptors","responseInterceptors","data","addCollection","addSingle","url","console","warn","collection","setServer","setName","single","interceptor","params","getCount","hasOwnProperty","updateOne","removeOne","getOnly","updateOnly","request","decodeURIComponent","requestBody","json","error","previous","current","body","headers","status","response","log","respond","stringify","group","groupCollapsed","method","requestHeaders","groupEnd","handle","jsonResponse","requestName","subResponse","sub","code","headerName","decode","batch","getSingleNames","matches","getCollection","id","contentRange","count","first","last","min","newResource","newResourceURI","Location","FetchServer","opts","req","Request","text","then","requestJson","Headers","reponse","getCollectionNames","hashClear","hashDelete","hashGet","hashHas","hashSet","Hash","entries","clear","entry","set","prototype","has","listCacheClear","listCacheDelete","listCacheGet","listCacheHas","listCacheSet","ListCache","Map","getNative","mapCacheClear","mapCacheDelete","mapCacheGet","mapCacheHas","mapCacheSet","MapCache","Symbol","iteratee","result","eq","castPath","toKey","object","path","getRawTag","objectToString","symToStringTag","toStringTag","isFunction","isMasked","isObject","toSource","reIsHostCtor","funcProto","Function","objectProto","funcToString","toString","reIsNative","call","test","arrayMap","isSymbol","symbolProto","symbolToString","baseToString","isKey","stringToPath","coreJsData","freeGlobal","g","isKeyable","__data__","baseIsNative","getValue","nativeObjectToString","isOwn","tag","unmasked","nativeCreate","size","reIsDeepProp","reIsPlainProp","type","uid","maskSrcKey","exec","IE_PROTO","func","assocIndexOf","pop","getMapData","memoize","cache","freeSelf","memoizeCapped","rePropName","reEscapeChar","string","charCodeAt","number","quote","subString","other","baseGet","defaultValue","baseGetTag","isObjectLike","resolver","TypeError","memoized","args","arguments","apply","Cache","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","n","getter","__esModule","d","definition","o","defineProperty","enumerable","globalThis","window","prop","r"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,IARrB,CASGK,MAAM,WACT,O,47CCRA,IAyBMC,EAAkB,SAACC,EAAKC,GAC1B,IAA6B,IAAzBD,EAAIE,QAAQ,QAAgB,CAE5B,IAAIC,EAAUH,EAAII,QAAQ,UAAW,IACrC,OAAO,SAAAC,GAAI,OAAIC,IAAID,EAAMF,IAAYF,GAEzC,IAA6B,IAAzBD,EAAIE,QAAQ,QAAgB,CAE5B,IAAIC,EAAUH,EAAII,QAAQ,UAAW,IACrC,OAAO,SAAAC,GAAI,OAAIC,IAAID,EAAMF,IAAYF,GAEzC,IAA4B,IAAxBD,EAAIE,QAAQ,OAAe,CAE3B,IAAIC,EAAUH,EAAII,QAA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Definition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FakeRest\"] = factory();\n\telse\n\t\troot[\"FakeRest\"] = factory();\n})(self, function() {\nreturn ","import get from 'lodash/get';\n\nconst every = (array, predicate) =>\n array.reduce((acc, value) => acc && predicate(value), true);\n\nconst some = (array, predicate) =>\n array.reduce((acc, value) => acc || predicate(value), false);\n\nconst getArrayOfObjectsPaths = (keyParts, item) => \n keyParts.reduce((acc, key, index) => {\n // If we already found an array, we don't need to explore further\n // For example with path `tags.name` when tags is an array of objects\n if (acc != undefined) {\n return acc;\n }\n \n let keyToArray = keyParts.slice(0, index + 1).join('.');\n let keyToItem = keyParts.slice(index + 1).join('.')\n let itemValue = get(item, keyToArray);\n \n // If the array is at the end of the key path, we will process it like we do normally with arrays\n // For example with path `deep.tags` where tags is the array. In this case, we return undefined\n return Array.isArray(itemValue) && index < keyParts.length - 1\n ? [keyToArray, keyToItem]\n : undefined;\n }, undefined);\n\nconst getSimpleFilter = (key, value) => {\n if (key.indexOf('_lte') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_lte)$/, '');\n return item => get(item, realKey) <= value;\n }\n if (key.indexOf('_gte') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_gte)$/, '');\n return item => get(item, realKey) >= value;\n }\n if (key.indexOf('_lt') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_lt)$/, '');\n return item => get(item, realKey) < value;\n }\n if (key.indexOf('_gt') !== -1) {\n // less than or equal\n let realKey = key.replace(/(_gt)$/, '');\n return item => get(item, realKey) > value;\n }\n if (Array.isArray(value)) {\n return item => {\n if (Array.isArray(get(item, key))) {\n // array filter and array item value: where all items in values\n return every(\n value,\n v => some(get(item, key), itemValue => itemValue == v)\n );\n }\n // where item in values\n return value.filter(v => v == get(item, key)).length > 0;\n }\n }\n return item => {\n if (Array.isArray(get(item, key)) && typeof value == 'string') {\n // simple filter but array item value: where value in item\n return get(item, key).indexOf(value) !== -1;\n }\n if (typeof get(item, key) == 'boolean' && typeof value == 'string') {\n // simple filter but boolean item value: boolean where\n return get(item, key) == (value === 'true' ? true : false);\n }\n // simple filter\n return get(item, key) == value;\n };\n}\n\nfunction filterItems(items, filter) {\n if (typeof filter === 'function') {\n return items.filter(filter);\n }\n if (filter instanceof Object) {\n // turn filter properties to functions\n var filterFunctions = Object.keys(filter).map(key => {\n if (key === 'q') {\n let regex = new RegExp(filter.q, 'i');\n // full-text filter\n return item => {\n for (let itemKey in item) {\n if (item[itemKey] && item[itemKey].match && item[itemKey].match(regex) !== null) return true;\n }\n return false;\n };\n }\n\n let keyParts = key.split('.');\n let value = filter[key];\n if (keyParts.length > 1) {\n return item => {\n let arrayOfObjectsPaths = getArrayOfObjectsPaths(keyParts, item);\n\n if (arrayOfObjectsPaths) {\n let [arrayPath, valuePath] = arrayOfObjectsPaths;\n // Check wether any item in the array matches the filter\n const filteredArrayItems = filterItems(get(item, arrayPath), {[valuePath]: value});\n return filteredArrayItems.length > 0;\n } else {\n return getSimpleFilter(key, value)(item);\n }\n }\n }\n\n return getSimpleFilter(key, value);\n });\n // only the items matching all filters functions are in (AND logic)\n return items.filter(item =>\n filterFunctions.reduce((selected, filterFunction) => selected && filterFunction(item), true)\n );\n }\n throw new Error('Unsupported filter type');\n}\n\nfunction sortItems(items, sort) {\n if (typeof sort === 'function') {\n return items.sort(sort);\n }\n if (typeof sort === 'string') {\n return items.sort(function(a, b) {\n if (a[sort] > b[sort]) {\n return 1;\n }\n if (a[sort] < b[sort]) {\n return -1;\n }\n return 0;\n });\n }\n if (Array.isArray(sort)) {\n let key = sort[0];\n let direction = sort[1].toLowerCase() == 'asc' ? 1 : -1;\n return items.sort(function(a, b) {\n if (a[key] > b[key]) {\n return direction;\n }\n if (a[key] < b[key]) {\n return -1 * direction ;\n }\n return 0;\n });\n }\n throw new Error('Unsupported sort type');\n}\n\nfunction rangeItems(items, range) {\n if (Array.isArray(range)) {\n return items.slice(range[0], range[1] !== undefined ? range[1] + 1 : undefined);\n }\n throw new Error('Unsupported range type');\n}\n\nexport class Collection {\n\n constructor(items=[], identifierName='id') {\n if (!Array.isArray(items)) {\n throw new Error('Can\\'t initialize a Collection with anything else than an array of items');\n }\n this.sequence = 0; // id of the next item\n this.identifierName = identifierName;\n this.items = [];\n this.server = null;\n this.name = null;\n items.map(this.addOne.bind(this));\n }\n\n /**\n * A Collection may need to access other collections (e.g. for embedding references)\n * This is done through a reference to the parent server.\n */\n setServer(server) {\n this.server = server;\n }\n\n setName(name) {\n this.name = name;\n }\n\n /**\n * Get a one to many embedder function for a given resource name\n *\n * @example embed posts for an author\n *\n * authorsCollection._oneToManyEmbedder('posts')\n *\n * @returns Function item => item\n */\n _oneToManyEmbedder(resourceName) {\n const singularResourceName = this.name.slice(0,-1);\n const referenceName = singularResourceName + '_id';\n return (item) => {\n const otherCollection = this.server.collections[resourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n if (Array.isArray(item[resourceName])) {\n // the many to one relationship is carried by an array of ids, e.g. { posts: [1, 2] } in authors\n item[resourceName] = otherCollection.getAll({\n filter: i => item[resourceName].indexOf(i[otherCollection.identifierName]) !== -1\n });\n } else {\n // the many to one relationship is carried by references in the related collection, e.g. { author_id: 1 } in posts\n item[resourceName] = otherCollection.getAll({\n filter: i => i[referenceName] == item[this.identifierName]\n });\n }\n return item;\n };\n }\n\n /**\n * Get a many to one embedder function for a given resource name\n *\n * @example embed author for a post\n *\n * postsCollection._manyToOneEmbedder('author')\n *\n * @returns Function item => item\n */\n _manyToOneEmbedder(resourceName) {\n const pluralResourceName = resourceName + 's';\n const referenceName = resourceName + '_id';\n return (item) => {\n const otherCollection = this.server.collections[pluralResourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n try {\n item[resourceName] = otherCollection.getOne(item[referenceName]);\n } catch (e) {\n // resource doesn't exist in the related collection - do not embed\n }\n return item;\n };\n }\n\n /**\n * @param String[] An array of resource names, e.g. ['books', 'country']\n * @returns Function item => item\n */\n _itemEmbedder(embed) {\n const resourceNames = Array.isArray(embed) ? embed : [embed];\n const resourceEmbedders = resourceNames.map(resourceName =>\n resourceName.endsWith('s') ? this._oneToManyEmbedder(resourceName) : this._manyToOneEmbedder(resourceName)\n );\n return item => resourceEmbedders.reduce((itemWithEmbeds, embedder) => embedder(itemWithEmbeds), item);\n }\n\n getCount(query) {\n return this.getAll(query).length;\n }\n\n getAll(query) {\n var items = this.items.slice(0); // clone the array to avoid updating the core one\n if (query) {\n if (query.filter) {\n items = filterItems(items, query.filter);\n }\n if (query.sort) {\n items = sortItems(items, query.sort);\n }\n if (query.range) {\n items = rangeItems(items, query.range);\n }\n items = items.map(item => Object.assign({}, item)) // clone item to avoid returning the original\n if (query.embed && this.server) {\n items = items.map(this._itemEmbedder(query.embed)); // embed reference\n }\n }\n return items;\n }\n\n getIndex(identifier) {\n return this.items.findIndex(item => item[this.identifierName] == identifier);\n }\n\n getOne(identifier, query) {\n let index = this.getIndex(identifier);\n if (index === -1) {\n throw new Error(`No item with identifier ${ identifier }`);\n }\n let item = this.items[index];\n item = Object.assign({}, item); // clone item to avoid returning the original\n if (query && query.embed && this.server) {\n item = this._itemEmbedder(query.embed)(item); // embed reference\n }\n return item;\n }\n\n addOne(item) {\n var identifier = item[this.identifierName];\n if (identifier !== undefined) {\n if (this.getIndex(identifier) !== -1) {\n throw new Error(`An item with the identifier ${ identifier } already exists`);\n } else {\n this.sequence = Math.max(this.sequence, identifier) + 1;\n }\n } else {\n item[this.identifierName] = this.sequence++;\n }\n this.items.push(item);\n return Object.assign({}, item); // clone item to avoid returning the original;\n }\n\n updateOne(identifier, item) {\n let index = this.getIndex(identifier);\n if (index === -1) {\n throw new Error(`No item with identifier ${ identifier }`);\n }\n for (let key in item) {\n this.items[index][key] = item[key];\n }\n return Object.assign({}, this.items[index]); // clone item to avoid returning the original\n }\n\n removeOne(identifier) {\n let index = this.getIndex(identifier);\n if (index === -1) {\n throw new Error(`No item with identifier ${ identifier }`);\n }\n var item = this.items[index];\n this.items.splice(index, 1);\n if (identifier == (this.sequence - 1)) {\n this.sequence--;\n }\n return item;\n }\n}\n","export class Single {\n constructor(obj) {\n if (!(obj instanceof Object)) {\n throw new Error('Can\\'t initialize a Single with anything except an object');\n }\n this.obj = obj;\n this.server = null;\n this.name = null;\n }\n\n /**\n * A Single may need to access other collections (e.g. for embedded\n * references) This is done through a reference to the parent server.\n */\n setServer(server) {\n this.server = server;\n }\n\n setName(name) {\n this.name = name;\n }\n\n // No need to embed Singles, since they are by their nature top-level\n // No need to worry about remote references, (i.e. mysingleton_id=1) since\n // it is by definition a singleton\n _oneToManyEmbedder(resourceName) {\n return (item) => {\n const otherCollection = this.server.collections[resourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n // We have an array of ids {posts: [1,2]} (back refs are not valid\n // for singleton)\n item[resourceName] = otherCollection.getAll({\n filter: i => item[resourceName].indexOf(i[otherCollection.identifierName]) !== -1\n });\n return item;\n }; \n }\n\n _manyToOneEmbedder(resourceName) {\n const pluralResourceName = resourceName + 's';\n const referenceName = resourceName + '_id';\n return (item) => {\n const otherCollection = this.server.collections[pluralResourceName];\n if (!otherCollection) throw new Error(`Can't embed a non-existing collection ${resourceName}`);\n try {\n item[resourceName] = otherCollection.getOne(item[referenceName]);\n } catch (e) {\n // Resource doesn't exist, so don't embed\n }\n return item;\n };\n }\n\n _itemEmbedder(embed) {\n const resourceNames = Array.isArray(embed) ? embed : [embed];\n const resourceEmbedders = resourceNames.map(resourceName =>\n resourceName.endsWith('s') ? this._oneToManyEmbedder(resourceName) : this._manyToOneEmbedder(resourceName)\n );\n return item => resourceEmbedders.reduce((itemWithEmbeds, embedder) => embedder(itemWithEmbeds), item);\n }\n\n getOnly(query) {\n let item = this.obj;\n if (query && query.embed && this.server) {\n item = Object.assign({}, item); // Clone\n item = this._itemEmbedder(query.embed)(item);\n }\n return item;\n }\n\n updateOnly(item) {\n for (let key in item) {\n this.obj[key] = item[key];\n }\n return this.obj;\n }\n}\n","export function parseQueryString(queryString) {\n if (!queryString) {\n return {};\n }\n let queryObject = {};\n let queryElements = queryString.split('&');\n\n queryElements.map(function(queryElement) {\n if (queryElement.indexOf('=') === -1) {\n queryObject[queryElement] = true;\n } else {\n let [key, value] = queryElement.split('=');\n if (value.indexOf('[') === 0 || value.indexOf('{') === 0) {\n value = JSON.parse(value);\n }\n queryObject[key.trim()] = value;\n }\n });\n\n return queryObject;\n}\n","import { Collection } from './Collection';\nimport { Single } from './Single';\nimport { parseQueryString } from './parseQueryString';\n\nexport class Server {\n constructor(baseUrl='') {\n this.baseUrl = baseUrl;\n this.loggingEnabled = false;\n this.defaultQuery = () => {};\n this.batchUrl = null;\n this.collections = {};\n this.singles = {};\n this.requestInterceptors = [];\n this.responseInterceptors = [];\n }\n\n /**\n * Shortcut for adding several collections if identifierName is always 'id'\n */\n init(data) {\n for (let name in data) {\n if (Array.isArray(data[name])) {\n this.addCollection(name, new Collection(data[name], 'id'));\n } else {\n this.addSingle(name, new Single(data[name]));\n }\n }\n }\n\n toggleLogging() {\n this.loggingEnabled = !this.loggingEnabled;\n }\n\n /**\n * @param Function ResourceName => object\n */\n setDefaultQuery(query) {\n this.defaultQuery = query;\n }\n\n setBatchUrl(batchUrl) {\n this.batchUrl = batchUrl;\n }\n\n /**\n * @deprecated use setBatchUrl instead\n */\n setBatch(url) {\n console.warn('Server.setBatch() is deprecated, use Server.setBatchUrl() instead');\n this.batchUrl = url;\n }\n\n addCollection(name, collection) {\n this.collections[name] = collection;\n collection.setServer(this);\n collection.setName(name);\n }\n\n getCollection(name) {\n return this.collections[name];\n }\n\n getCollectionNames() {\n return Object.keys(this.collections);\n }\n\n addSingle(name, single) {\n this.singles[name] = single;\n single.setServer(this);\n single.setName(name);\n }\n\n getSingle(name) {\n return this.singles[name];\n }\n\n getSingleNames() {\n return Object.keys(this.singles);\n }\n\n addRequestInterceptor(interceptor) {\n this.requestInterceptors.push(interceptor);\n }\n\n addResponseInterceptor(interceptor) {\n this.responseInterceptors.push(interceptor);\n }\n\n /**\n * @param {string} name\n * @param {string} params As decoded from the query string, e.g. { sort: \"name\", filter: {enabled:true}, slice: [10, 20] }\n */\n getCount(name, params) {\n return this.collections[name].getCount(params);\n }\n\n /**\n * @param {string} name\n * @param {string} params As decoded from the query string, e.g. { sort: \"name\", filter: {enabled:true}, slice: [10, 20] }\n */\n getAll(name, params) {\n return this.collections[name].getAll(params);\n }\n\n getOne(name, identifier, params) {\n return this.collections[name].getOne(identifier, params);\n }\n\n addOne(name, item) {\n if (!this.collections.hasOwnProperty(name)) {\n this.addCollection(name, new Collection([], 'id'));\n }\n return this.collections[name].addOne(item);\n }\n\n updateOne(name, identifier, item) {\n return this.collections[name].updateOne(identifier, item);\n }\n\n removeOne(name, identifier) {\n return this.collections[name].removeOne(identifier);\n }\n\n getOnly(name, params) {\n return this.singles[name].getOnly();\n }\n\n updateOnly(name, item) {\n return this.singles[name].updateOnly(item);\n }\n\n\n decode(request) {\n request.queryString = decodeURIComponent(request.url.slice(request.url.indexOf('?') + 1));\n request.params = parseQueryString(request.queryString);\n if (request.requestBody) {\n try {\n request.json = JSON.parse(request.requestBody);\n } catch(error) {\n // body isn't JSON, skipping\n }\n }\n return this.requestInterceptors.reduce(function(previous, current) {\n return current(previous);\n }, request);\n }\n\n respond(body, headers, request, status=200) {\n if (!headers) {\n headers = {};\n }\n if (!headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n let response = { status: status, headers: headers, body: body };\n response = this.responseInterceptors.reduce(function(previous, current) {\n return current(previous, request);\n }, response);\n this.log(request, response);\n\n return request.respond(response.status, response.headers, JSON.stringify(response.body));\n }\n\n log(request, response) {\n if (!this.loggingEnabled) return;\n if (console.group) {\n // Better logging in Chrome\n console.groupCollapsed(request.method, request.url, '(FakeRest)');\n console.group('request');\n console.log(request.method, request.url);\n console.log('headers', request.requestHeaders);\n console.log('body ', request.requestBody);\n console.groupEnd();\n console.group('response', response.status);\n console.log('headers', response.headers);\n console.log('body ', response.body);\n console.groupEnd();\n console.groupEnd();\n } else {\n console.log('FakeRest request ', request.method, request.url, 'headers', request.requestHeaders, 'body', request.requestBody);\n console.log('FakeRest response', response.status, 'headers', response.headers, 'body', response.body);\n }\n }\n\n batch(request) {\n\n var json = request.json;\n var handle = this.handle.bind(this);\n\n var jsonResponse = Object.keys(json).reduce(function (jsonResponse, requestName) {\n var subResponse;\n var sub = {\n url: json[requestName],\n method: 'GET',\n params: {},\n respond: function (code, headers, body) {\n subResponse = {\n code: code,\n headers: Object.keys(headers || {}).map(function (headerName) {\n return {\n 'name': headerName,\n 'value': headers[headerName]\n };\n }),\n body: body || {}\n };\n }\n };\n handle(sub);\n\n jsonResponse[requestName] = subResponse || {\n code: 404,\n headers: [],\n body: {}\n };\n\n return jsonResponse;\n }, {});\n\n return this.respond(jsonResponse, {}, request, 200);\n }\n\n /**\n * @param {FakeXMLHttpRequest} request\n *\n * String request.url The URL set on the request object.\n * String request.method The request method as a string.\n * Object request.requestHeaders An object of all request headers, i.e.:\n * {\n * \"Accept\": \"text/html\",\n * \"Connection\": \"keep-alive\"\n * }\n * String request.requestBody The request body\n * String request.username Username, if any.\n * String request.password Password, if any.\n */\n handle(request) {\n request = this.decode(request);\n\n if (this.batchUrl && this.batchUrl === request.url && request.method === 'POST') {\n return this.batch(request);\n }\n\n // Handle Single Objects\n for (let name of this.getSingleNames()) {\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/(' + name + ')(\\\\/?.*)?$' ));\n if (!matches) continue;\n\n if (request.method == 'GET') {\n try {\n let item = this.getOnly(name);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PUT') {\n try {\n let item = this.updateOnly(name, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PATCH') {\n try {\n let item = this.updateOnly(name, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n }\n\n // Handle collections\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/([^\\\\/?]+)(\\\\/(\\\\d+))?(\\\\?.*)?$' ));\n if (!matches) return;\n let name = matches[1];\n let params = Object.assign({}, this.defaultQuery(name), request.params);\n if (!matches[2]) {\n if (request.method == 'GET') {\n if (!this.getCollection(name)) {\n return;\n }\n let count = this.getCount(name, params.filter ? { filter: params.filter } : {});\n let items, contentRange, status;\n if (count > 0) {\n items = this.getAll(name, params);\n let first = params.range ? params.range[0] : 0;\n let last = params.range ? Math.min(items.length - 1 + first, params.range[1]) : (items.length - 1);\n contentRange = `items ${first}-${last}/${count}`;\n status = (items.length == count) ? 200 : 206;\n } else {\n items = [];\n contentRange = 'items */0';\n status = 200;\n }\n return this.respond(items, { 'Content-Range': contentRange }, request, status);\n }\n if (request.method == 'POST') {\n let newResource = this.addOne(name, request.json);\n let newResourceURI = this.baseUrl + '/' + name + '/' + newResource[this.getCollection(name).identifierName];\n return this.respond(newResource, { Location: newResourceURI }, request, 201);\n }\n } else {\n if (!this.getCollection(name)) {\n return;\n }\n let id = matches[3];\n if (request.method == 'GET') {\n try {\n let item = this.getOne(name, id, params);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PUT') {\n try {\n let item = this.updateOne(name, id, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'PATCH') {\n try {\n let item = this.updateOne(name, id, request.json);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n if (request.method == 'DELETE') {\n try {\n let item = this.removeOne(name, id);\n return this.respond(item, null, request);\n } catch (error) {\n return request.respond(404);\n }\n }\n }\n }\n\n getHandler() {\n return this.handle.bind(this);\n }\n}\n","import { Server } from './Server';\nimport { parseQueryString } from './parseQueryString';\n\nexport class FetchServer extends Server {\n decode(request, opts) {\n const req = (typeof request === 'string') ? new Request(request, opts) : request;\n req.queryString = decodeURIComponent(req.url.slice(req.url.indexOf('?') + 1));\n req.params = parseQueryString(req.queryString);\n return req.text()\n .then(text => {\n req.requestBody = text\n try {\n req.requestJson = JSON.parse(text)\n } catch(e) {\n // not JSON, no big deal\n }\n })\n .then(() => this.requestInterceptors.reduce((previous, current) => current(previous), req))\n }\n\n respond(response, request) {\n response = this.responseInterceptors.reduce(function(previous, current) {\n return current(previous, request);\n }, response);\n this.log(request, response);\n response.headers = new Headers(response.headers)\n\n return response;\n }\n\n log(request, response) {\n if (!this.loggingEnabled) return;\n if (console.group) {\n // Better logging in Chrome\n console.groupCollapsed(request.method, request.url, '(FakeRest)');\n console.group('request');\n console.log(request.method, request.url);\n console.log('headers', request.headers);\n console.log('body ', request.requestBody);\n console.groupEnd();\n console.group('response', response.status);\n console.log('headers', response.headers);\n console.log('body ', response.body);\n console.groupEnd();\n console.groupEnd();\n } else {\n console.log('FakeRest request ', request.method, request.url, 'headers', request.headers, 'body', request.requestBody);\n console.log('FakeRest response', response.status, 'headers', response.headers, 'body', response.body);\n }\n }\n\n batch(request) {\n throw new Error('not implemented');\n }\n\n /**\n * @param {Request} fetch request\n * @param {Object} options\n *\n */\n handle(req, opts) {\n return this.decode(req, opts)\n .then(request => {\n const response = {\n headers: {'Content-Type': 'application/json' },\n status: 200,\n };\n\n // handle batch request\n if (this.batchUrl && this.batchUrl === request.url && request.method === 'POST') {\n return this.batch(request);\n }\n\n // Handle Single Objects\n for (let name of this.getSingleNames()) {\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/(' + name + ')(\\\\/?.*)?$' ));\n if (!matches) continue;\n\n if (request.method == 'GET') {\n try {\n response.body = this.getOnly(name);\n } catch (error) {\n reponse.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PUT') {\n try {\n response.body = this.updateOnly(name, request.requestJson);\n } catch (error) {\n reponse.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PATCH') {\n try {\n response.body = this.updateOnly(name, request.requestJson);\n } catch (error) {\n reponse.status = 404;\n }\n return this.respond(response, request);\n }\n }\n\n // handle collections\n for (let name of this.getCollectionNames()) {\n let matches = request.url.match(new RegExp('^' + this.baseUrl + '\\\\/(' + name + ')(\\\\/(\\\\d+))?(\\\\?.*)?$' ));\n if (!matches) continue;\n let params = Object.assign({}, this.defaultQuery(name), request.params);\n if (!matches[2]) {\n if (request.method == 'GET') {\n let count = this.getCount(name, params.filter ? { filter: params.filter } : {});\n if (count > 0) {\n let items = this.getAll(name, params);\n let first = params.range ? params.range[0] : 0;\n let last = params.range ? Math.min(items.length - 1 + first, params.range[1]) : (items.length - 1);\n response.body = items;\n response.headers['Content-Range'] = `items ${first}-${last}/${count}`;\n response.status = (items.length == count) ? 200 : 206;\n } else {\n response.body = [];\n response.headers['Content-Range'] = 'items */0';\n }\n return this.respond(response, request);\n }\n if (request.method == 'POST') {\n let newResource = this.addOne(name, request.requestJson);\n let newResourceURI = this.baseUrl + '/' + name + '/' + newResource[this.getCollection(name).identifierName];\n response.body = newResource;\n response.headers['Location'] = newResourceURI;\n response.status = 201;\n return this.respond(response, request);\n }\n } else {\n let id = matches[3];\n if (request.method == 'GET') {\n try {\n response.body = this.getOne(name, id, params);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PUT') {\n try {\n response.body = this.updateOne(name, id, request.requestJson);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'PATCH') {\n try {\n response.body = this.updateOne(name, id, request.requestJson);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n if (request.method == 'DELETE') {\n try {\n response.body = this.removeOne(name, id);\n } catch (error) {\n response.status = 404;\n }\n return this.respond(response, request);\n }\n }\n }\n return this.respond(response, request);\n });\n }\n}\n","import { Server } from './Server';\nimport { FetchServer } from './FetchServer';\nimport { Collection } from './Collection';\nimport { Single } from './Single';\n\nexport { Server, FetchServer, Collection, Single };\nexport default { Server, FetchServer, Collection, Single };\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(6499);\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 3910b6c..82bf757 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fakerest", - "version": "3.1.0", + "version": "3.2.0", "repository": "https://github.com/marmelab/FakeRest", "description": "Patch XMLHttpRequest to fake a REST server based on JSON data. ", "scripts": { diff --git a/src/Collection.js b/src/Collection.js index e33f315..212b8c4 100644 --- a/src/Collection.js +++ b/src/Collection.js @@ -1,4 +1,5 @@ import get from 'lodash/get'; +import matches from 'lodash/matches'; const every = (array, predicate) => array.reduce((acc, value) => acc && predicate(value), true); @@ -59,6 +60,11 @@ const getSimpleFilter = (key, value) => { return value.filter(v => v == get(item, key)).length > 0; } } + + if (typeof value === 'object') { + return item => matches(value)(get(item, key)); + } + return item => { if (Array.isArray(get(item, key)) && typeof value == 'string') { // simple filter but array item value: where value in item diff --git a/src/Collection.spec.js b/src/Collection.spec.js index b48457d..756ebaa 100644 --- a/src/Collection.spec.js +++ b/src/Collection.spec.js @@ -188,6 +188,16 @@ describe("Collection", () => { expect(collection.getAll({ filter: { "deep.value": "b" } })).toEqual(expected); }); + it("should filter values with objects", () => { + const collection = new Collection([ + { name: "c", deep: { value: "c" } }, + { name: "a", deep: { value: "a" } }, + { name: "b", deep: { value: "b" } }, + ]); + const expected = [{ name: "b", deep: { value: "b" }, id: 2 }]; + expect(collection.getAll({ filter: { deep: { value: "b" } } })).toEqual(expected); + }); + it("should filter boolean values properly", () => { const collection = new Collection([ { name: "a", is: true },