iwmlib/lib/3rdparty/dexie.js.map

1 line
352 KiB
Plaintext
Raw Normal View History

2019-03-21 09:57:27 +01:00
{"version":3,"file":"dexie.js","sources":["../src/utils.js","../src/debug.js","../src/errors.js","../src/chaining-functions.js","../src/Promise.js","../src/Events.js","../src/Dexie.js"],"sourcesContent":["export var keys = Object.keys;\r\nexport var isArray = Array.isArray;\r\nexport var _global =\r\n typeof self !== 'undefined' ? self :\r\n typeof window !== 'undefined' ? window :\r\n global;\r\n\r\nexport function extend(obj, extension) {\r\n if (typeof extension !== 'object') return obj;\r\n keys(extension).forEach(function (key) {\r\n obj[key] = extension[key];\r\n });\r\n return obj;\r\n}\r\n\r\nexport const getProto = Object.getPrototypeOf;\r\nexport const _hasOwn = {}.hasOwnProperty;\r\nexport function hasOwn(obj, prop) {\r\n return _hasOwn.call(obj, prop);\r\n}\r\n\r\nexport function props (proto, extension) {\r\n if (typeof extension === 'function') extension = extension(getProto(proto));\r\n keys(extension).forEach(key => {\r\n setProp(proto, key, extension[key]);\r\n });\r\n}\r\n\r\nexport const defineProperty = Object.defineProperty;\r\n\r\nexport function setProp(obj, prop, functionOrGetSet, options) {\r\n defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, \"get\") && typeof functionOrGetSet.get === 'function' ?\r\n {get: functionOrGetSet.get, set: functionOrGetSet.set, configurable: true} :\r\n {value: functionOrGetSet, configurable: true, writable: true}, options));\r\n}\r\n\r\nexport function derive(Child) {\r\n return {\r\n from: function (Parent) {\r\n Child.prototype = Object.create(Parent.prototype);\r\n setProp(Child.prototype, \"constructor\", Child);\r\n return {\r\n extend: props.bind(null, Child.prototype)\r\n };\r\n }\r\n };\r\n}\r\n\r\nexport const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\r\n\r\nexport function getPropertyDescriptor(obj, prop) {\r\n var pd = getOwnPropertyDescriptor(obj, prop),\r\n proto;\r\n return pd || (proto = getProto(obj)) && getPropertyDescriptor (proto, prop);\r\n}\r\n\r\nvar _slice = [].slice;\r\nexport function slice(args, start, end) {\r\n return _slice.call(args, start, end);\r\n}\r\n\r\nexport function override(origFunc, overridedFactory) {\r\n return overridedFactory(origFunc);\r\n}\r\n\r\nexport function doFakeAutoComplete(fn) {\r\n var to = setTimeout(fn, 1000);\r\n clearTimeout(to);\r\n}\r\n\r\nexport function assert (b) {\r\n if (!b) throw new Error(\"Assertion Failed\");\r\n}\r\n\r\nexport function asap(fn) {\r\n if (_global.setImmediate) setImmediate(fn); else setTimeout(fn, 0);\r\n}\r\n\r\nexport function getUniqueArray(a) {\r\n return a.filter((value, index, self) => self.indexOf(value) === index);\r\n}\r\n\r\n/** Generate an object (hash map) based on given array.\r\n * @param extractor Function taking an array item and its index and returning an array of 2 items ([key, value]) to\r\n * instert on the resulting object for each item in the array. If this function returns a falsy value, the\r\n * current item wont affect the resulting object.\r\n */\r\nexport function arrayToObject (array, extractor) {\r\n return array.reduce((result, item, i) => {\r\n var nameAndValue = extractor(item, i);\r\n if (nameAndValue) result[nameAndValue[0]] = nameAndValue[1];\r\n return result;\r\n }, {});\r\n}\r\n\r\nexport function trycatcher(fn, reject) {\r\n return function () {\r\n try {\r\n fn.apply(this, arguments);\r\n } catch (e) {\r\n reject(e);\r\n }\r\n };\r\n}\r\n\r\nexport function tryCatch(fn, onerror, args) {\r\n try {\r\n fn.apply(null, args);\r\n } catch (ex) {\r\n onerror && onerror(ex);\r\n }\r\n}\r\n\r\nexport function getByKeyPath(obj, keyPath) {\r\n // http://www.w3.org/TR/IndexedDB/#steps-for-extracting-a-key-from-a-value-using-a-key-path\r\n if (hasOwn(obj, keyPath)) return obj[keyPath]; // This line is moved from