redux-state-sync
Advanced tools
Comparing version 0.0.4 to 0.1.0
@@ -6,16 +6,4 @@ 'use strict'; | ||
}); | ||
exports.actionStorageMiddleware = undefined; | ||
exports.timestampAction = timestampAction; | ||
exports.createStorageListener = createStorageListener; | ||
var _indexOf = require('lodash/indexOf'); | ||
var _indexOf2 = _interopRequireDefault(_indexOf); | ||
var _get = require('lodash/get'); | ||
var _get2 = _interopRequireDefault(_get); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* global window localStorage true */ | ||
@@ -42,3 +30,3 @@ var lastTimeStamp = 0; | ||
} catch (e) { | ||
console.log("Your browser doesn't support localStorage"); | ||
console.error("Your browser doesn't support localStorage"); | ||
} | ||
@@ -51,7 +39,17 @@ } | ||
function createStorageListener(store, config) { | ||
var ignore = []; | ||
if (config) { | ||
ignore = (0, _get2.default)(config, 'ignore', []); | ||
function createStorageListener(store) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var allowed = function allowed() { | ||
return true; | ||
}; | ||
if (config.predicate && typeof config.predicate === 'function') { | ||
allowed = config.predicate; | ||
} else if (Array.isArray(config.ignore)) { | ||
allowed = function allowed(type) { | ||
return config.ignore.indexOf(type) >= 0; | ||
}; | ||
} | ||
window.addEventListener('storage', function (event) { | ||
@@ -61,3 +59,3 @@ var _JSON$parse = JSON.parse(event.newValue), | ||
if (stampedAction && stampedAction.$time !== lastTimeStamp && (0, _indexOf2.default)(ignore, stampedAction.type) < 0) { | ||
if (stampedAction && stampedAction.$time !== lastTimeStamp && !!allowed(stampedAction.type)) { | ||
lastTimeStamp = stampedAction.$time; | ||
@@ -64,0 +62,0 @@ store.dispatch(stampedAction); |
@@ -76,3 +76,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 12); | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
@@ -84,340 +84,2 @@ /************************************************************************/ | ||
var eq = __webpack_require__(53); | ||
/** | ||
* Gets the index at which the `key` is found in `array` of key-value pairs. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {*} key The key to search for. | ||
* @returns {number} Returns the index of the matched value, else `-1`. | ||
*/ | ||
function assocIndexOf(array, key) { | ||
var length = array.length; | ||
while (length--) { | ||
if (eq(array[length][0], key)) { | ||
return length; | ||
} | ||
} | ||
return -1; | ||
} | ||
module.exports = assocIndexOf; | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isKeyable = __webpack_require__(35); | ||
/** | ||
* Gets the data for `map`. | ||
* | ||
* @private | ||
* @param {Object} map The map to query. | ||
* @param {string} key The reference key. | ||
* @returns {*} Returns the map data. | ||
*/ | ||
function getMapData(map, key) { | ||
var data = map.__data__; | ||
return isKeyable(key) | ||
? data[typeof key == 'string' ? 'string' : 'hash'] | ||
: data.map; | ||
} | ||
module.exports = getMapData; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var getNative = __webpack_require__(9); | ||
/* Built-in method references that are verified to be native. */ | ||
var nativeCreate = getNative(Object, 'create'); | ||
module.exports = nativeCreate; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseGetTag = __webpack_require__(8), | ||
isObjectLike = __webpack_require__(55); | ||
/** `Object#toString` result references. */ | ||
var symbolTag = '[object Symbol]'; | ||
/** | ||
* Checks if `value` is classified as a `Symbol` primitive or object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`. | ||
* @example | ||
* | ||
* _.isSymbol(Symbol.iterator); | ||
* // => true | ||
* | ||
* _.isSymbol('abc'); | ||
* // => false | ||
*/ | ||
function isSymbol(value) { | ||
return typeof value == 'symbol' || | ||
(isObjectLike(value) && baseGetTag(value) == symbolTag); | ||
} | ||
module.exports = isSymbol; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var root = __webpack_require__(5); | ||
/** Built-in value references. */ | ||
var Symbol = root.Symbol; | ||
module.exports = Symbol; | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var freeGlobal = __webpack_require__(26); | ||
/** Detect free variable `self`. */ | ||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
/** Used as a reference to the global object. */ | ||
var root = freeGlobal || freeSelf || Function('return this')(); | ||
module.exports = root; | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Checks if `value` is classified as an `Array` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an array, else `false`. | ||
* @example | ||
* | ||
* _.isArray([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isArray(document.body.children); | ||
* // => false | ||
* | ||
* _.isArray('abc'); | ||
* // => false | ||
* | ||
* _.isArray(_.noop); | ||
* // => false | ||
*/ | ||
var isArray = Array.isArray; | ||
module.exports = isArray; | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
* @example | ||
* | ||
* _.isObject({}); | ||
* // => true | ||
* | ||
* _.isObject([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObject(_.noop); | ||
* // => true | ||
* | ||
* _.isObject(null); | ||
* // => false | ||
*/ | ||
function isObject(value) { | ||
var type = typeof value; | ||
return value != null && (type == 'object' || type == 'function'); | ||
} | ||
module.exports = isObject; | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var Symbol = __webpack_require__(4), | ||
getRawTag = __webpack_require__(27), | ||
objectToString = __webpack_require__(48); | ||
/** `Object#toString` result references. */ | ||
var nullTag = '[object Null]', | ||
undefinedTag = '[object Undefined]'; | ||
/** Built-in value references. */ | ||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined; | ||
/** | ||
* The base implementation of `getTag` without fallbacks for buggy environments. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {string} Returns the `toStringTag`. | ||
*/ | ||
function baseGetTag(value) { | ||
if (value == null) { | ||
return value === undefined ? undefinedTag : nullTag; | ||
} | ||
return (symToStringTag && symToStringTag in Object(value)) | ||
? getRawTag(value) | ||
: objectToString(value); | ||
} | ||
module.exports = baseGetTag; | ||
/***/ }), | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseIsNative = __webpack_require__(22), | ||
getValue = __webpack_require__(28); | ||
/** | ||
* Gets the native function at `key` of `object`. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @param {string} key The key of the method to get. | ||
* @returns {*} Returns the function if it's native, else `undefined`. | ||
*/ | ||
function getNative(object, key) { | ||
var value = getValue(object, key); | ||
return baseIsNative(value) ? value : undefined; | ||
} | ||
module.exports = getNative; | ||
/***/ }), | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseGet = __webpack_require__(19); | ||
/** | ||
* Gets the value at `path` of `object`. If the resolved value is | ||
* `undefined`, the `defaultValue` is returned in its place. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 3.7.0 | ||
* @category Object | ||
* @param {Object} object The object to query. | ||
* @param {Array|string} path The path of the property to get. | ||
* @param {*} [defaultValue] The value returned for `undefined` resolved values. | ||
* @returns {*} Returns the resolved value. | ||
* @example | ||
* | ||
* var object = { 'a': [{ 'b': { 'c': 3 } }] }; | ||
* | ||
* _.get(object, 'a[0].b.c'); | ||
* // => 3 | ||
* | ||
* _.get(object, ['a', '0', 'b', 'c']); | ||
* // => 3 | ||
* | ||
* _.get(object, 'a.b.c', 'default'); | ||
* // => 'default' | ||
*/ | ||
function get(object, path, defaultValue) { | ||
var result = object == null ? undefined : baseGet(object, path); | ||
return result === undefined ? defaultValue : result; | ||
} | ||
module.exports = get; | ||
/***/ }), | ||
/* 11 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseIndexOf = __webpack_require__(20), | ||
toInteger = __webpack_require__(58); | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
/** | ||
* Gets the index at which the first occurrence of `value` is found in `array` | ||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | ||
* for equality comparisons. If `fromIndex` is negative, it's used as the | ||
* offset from the end of `array`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Array | ||
* @param {Array} array The array to inspect. | ||
* @param {*} value The value to search for. | ||
* @param {number} [fromIndex=0] The index to search from. | ||
* @returns {number} Returns the index of the matched value, else `-1`. | ||
* @example | ||
* | ||
* _.indexOf([1, 2, 1, 2], 2); | ||
* // => 1 | ||
* | ||
* // Search from the `fromIndex`. | ||
* _.indexOf([1, 2, 1, 2], 2, 2); | ||
* // => 3 | ||
*/ | ||
function indexOf(array, value, fromIndex) { | ||
var length = array == null ? 0 : array.length; | ||
if (!length) { | ||
return -1; | ||
} | ||
var index = fromIndex == null ? 0 : toInteger(fromIndex); | ||
if (index < 0) { | ||
index = nativeMax(length + index, 0); | ||
} | ||
return baseIndexOf(array, value, index); | ||
} | ||
module.exports = indexOf; | ||
/***/ }), | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
@@ -429,16 +91,4 @@ | ||
}); | ||
exports.actionStorageMiddleware = undefined; | ||
exports.timestampAction = timestampAction; | ||
exports.createStorageListener = createStorageListener; | ||
var _indexOf = __webpack_require__(11); | ||
var _indexOf2 = _interopRequireDefault(_indexOf); | ||
var _get = __webpack_require__(10); | ||
var _get2 = _interopRequireDefault(_get); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* global window localStorage true */ | ||
@@ -465,3 +115,3 @@ var lastTimeStamp = 0; | ||
} catch (e) { | ||
console.log("Your browser doesn't support localStorage"); | ||
console.error("Your browser doesn't support localStorage"); | ||
} | ||
@@ -474,7 +124,17 @@ } | ||
function createStorageListener(store, config) { | ||
var ignore = []; | ||
if (config) { | ||
ignore = (0, _get2.default)(config, 'ignore', []); | ||
function createStorageListener(store) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var allowed = function allowed() { | ||
return true; | ||
}; | ||
if (config.predicate && typeof config.predicate === 'function') { | ||
allowed = config.predicate; | ||
} else if (Array.isArray(config.ignore)) { | ||
allowed = function allowed(type) { | ||
return config.ignore.indexOf(type) >= 0; | ||
}; | ||
} | ||
window.addEventListener('storage', function (event) { | ||
@@ -484,3 +144,3 @@ var _JSON$parse = JSON.parse(event.newValue), | ||
if (stampedAction && stampedAction.$time !== lastTimeStamp && (0, _indexOf2.default)(ignore, stampedAction.type) < 0) { | ||
if (stampedAction && stampedAction.$time !== lastTimeStamp && !!allowed(stampedAction.type)) { | ||
lastTimeStamp = stampedAction.$time; | ||
@@ -492,1564 +152,2 @@ store.dispatch(stampedAction); | ||
/***/ }), | ||
/* 13 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var hashClear = __webpack_require__(29), | ||
hashDelete = __webpack_require__(30), | ||
hashGet = __webpack_require__(31), | ||
hashHas = __webpack_require__(32), | ||
hashSet = __webpack_require__(33); | ||
/** | ||
* Creates a hash object. | ||
* | ||
* @private | ||
* @constructor | ||
* @param {Array} [entries] The key-value pairs to cache. | ||
*/ | ||
function Hash(entries) { | ||
var index = -1, | ||
length = entries == null ? 0 : entries.length; | ||
this.clear(); | ||
while (++index < length) { | ||
var entry = entries[index]; | ||
this.set(entry[0], entry[1]); | ||
} | ||
} | ||
// Add methods to `Hash`. | ||
Hash.prototype.clear = hashClear; | ||
Hash.prototype['delete'] = hashDelete; | ||
Hash.prototype.get = hashGet; | ||
Hash.prototype.has = hashHas; | ||
Hash.prototype.set = hashSet; | ||
module.exports = Hash; | ||
/***/ }), | ||
/* 14 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var listCacheClear = __webpack_require__(37), | ||
listCacheDelete = __webpack_require__(38), | ||
listCacheGet = __webpack_require__(39), | ||
listCacheHas = __webpack_require__(40), | ||
listCacheSet = __webpack_require__(41); | ||
/** | ||
* Creates an list cache object. | ||
* | ||
* @private | ||
* @constructor | ||
* @param {Array} [entries] The key-value pairs to cache. | ||
*/ | ||
function ListCache(entries) { | ||
var index = -1, | ||
length = entries == null ? 0 : entries.length; | ||
this.clear(); | ||
while (++index < length) { | ||
var entry = entries[index]; | ||
this.set(entry[0], entry[1]); | ||
} | ||
} | ||
// Add methods to `ListCache`. | ||
ListCache.prototype.clear = listCacheClear; | ||
ListCache.prototype['delete'] = listCacheDelete; | ||
ListCache.prototype.get = listCacheGet; | ||
ListCache.prototype.has = listCacheHas; | ||
ListCache.prototype.set = listCacheSet; | ||
module.exports = ListCache; | ||
/***/ }), | ||
/* 15 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var getNative = __webpack_require__(9), | ||
root = __webpack_require__(5); | ||
/* Built-in method references that are verified to be native. */ | ||
var Map = getNative(root, 'Map'); | ||
module.exports = Map; | ||
/***/ }), | ||
/* 16 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var mapCacheClear = __webpack_require__(42), | ||
mapCacheDelete = __webpack_require__(43), | ||
mapCacheGet = __webpack_require__(44), | ||
mapCacheHas = __webpack_require__(45), | ||
mapCacheSet = __webpack_require__(46); | ||
/** | ||
* Creates a map cache object to store key-value pairs. | ||
* | ||
* @private | ||
* @constructor | ||
* @param {Array} [entries] The key-value pairs to cache. | ||
*/ | ||
function MapCache(entries) { | ||
var index = -1, | ||
length = entries == null ? 0 : entries.length; | ||
this.clear(); | ||
while (++index < length) { | ||
var entry = entries[index]; | ||
this.set(entry[0], entry[1]); | ||
} | ||
} | ||
// Add methods to `MapCache`. | ||
MapCache.prototype.clear = mapCacheClear; | ||
MapCache.prototype['delete'] = mapCacheDelete; | ||
MapCache.prototype.get = mapCacheGet; | ||
MapCache.prototype.has = mapCacheHas; | ||
MapCache.prototype.set = mapCacheSet; | ||
module.exports = MapCache; | ||
/***/ }), | ||
/* 17 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* A specialized version of `_.map` for arrays without support for iteratee | ||
* shorthands. | ||
* | ||
* @private | ||
* @param {Array} [array] The array to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @returns {Array} Returns the new mapped array. | ||
*/ | ||
function arrayMap(array, iteratee) { | ||
var index = -1, | ||
length = array == null ? 0 : array.length, | ||
result = Array(length); | ||
while (++index < length) { | ||
result[index] = iteratee(array[index], index, array); | ||
} | ||
return result; | ||
} | ||
module.exports = arrayMap; | ||
/***/ }), | ||
/* 18 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* The base implementation of `_.findIndex` and `_.findLastIndex` without | ||
* support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {Function} predicate The function invoked per iteration. | ||
* @param {number} fromIndex The index to search from. | ||
* @param {boolean} [fromRight] Specify iterating from right to left. | ||
* @returns {number} Returns the index of the matched value, else `-1`. | ||
*/ | ||
function baseFindIndex(array, predicate, fromIndex, fromRight) { | ||
var length = array.length, | ||
index = fromIndex + (fromRight ? 1 : -1); | ||
while ((fromRight ? index-- : ++index < length)) { | ||
if (predicate(array[index], index, array)) { | ||
return index; | ||
} | ||
} | ||
return -1; | ||
} | ||
module.exports = baseFindIndex; | ||
/***/ }), | ||
/* 19 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var castPath = __webpack_require__(24), | ||
toKey = __webpack_require__(51); | ||
/** | ||
* The base implementation of `_.get` without support for default values. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @param {Array|string} path The path of the property to get. | ||
* @returns {*} Returns the resolved value. | ||
*/ | ||
function baseGet(object, path) { | ||
path = castPath(path, object); | ||
var index = 0, | ||
length = path.length; | ||
while (object != null && index < length) { | ||
object = object[toKey(path[index++])]; | ||
} | ||
return (index && index == length) ? object : undefined; | ||
} | ||
module.exports = baseGet; | ||
/***/ }), | ||
/* 20 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseFindIndex = __webpack_require__(18), | ||
baseIsNaN = __webpack_require__(21), | ||
strictIndexOf = __webpack_require__(49); | ||
/** | ||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {*} value The value to search for. | ||
* @param {number} fromIndex The index to search from. | ||
* @returns {number} Returns the index of the matched value, else `-1`. | ||
*/ | ||
function baseIndexOf(array, value, fromIndex) { | ||
return value === value | ||
? strictIndexOf(array, value, fromIndex) | ||
: baseFindIndex(array, baseIsNaN, fromIndex); | ||
} | ||
module.exports = baseIndexOf; | ||
/***/ }), | ||
/* 21 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* The base implementation of `_.isNaN` without support for number objects. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. | ||
*/ | ||
function baseIsNaN(value) { | ||
return value !== value; | ||
} | ||
module.exports = baseIsNaN; | ||
/***/ }), | ||
/* 22 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isFunction = __webpack_require__(54), | ||
isMasked = __webpack_require__(36), | ||
isObject = __webpack_require__(7), | ||
toSource = __webpack_require__(52); | ||
/** | ||
* Used to match `RegExp` | ||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). | ||
*/ | ||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; | ||
/** Used to detect host constructors (Safari). */ | ||
var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
/** Used for built-in method references. */ | ||
var funcProto = Function.prototype, | ||
objectProto = Object.prototype; | ||
/** Used to resolve the decompiled source of functions. */ | ||
var funcToString = funcProto.toString; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** Used to detect if a method is native. */ | ||
var reIsNative = RegExp('^' + | ||
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') | ||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
); | ||
/** | ||
* The base implementation of `_.isNative` without bad shim checks. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a native function, | ||
* else `false`. | ||
*/ | ||
function baseIsNative(value) { | ||
if (!isObject(value) || isMasked(value)) { | ||
return false; | ||
} | ||
var pattern = isFunction(value) ? reIsNative : reIsHostCtor; | ||
return pattern.test(toSource(value)); | ||
} | ||
module.exports = baseIsNative; | ||
/***/ }), | ||
/* 23 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var Symbol = __webpack_require__(4), | ||
arrayMap = __webpack_require__(17), | ||
isArray = __webpack_require__(6), | ||
isSymbol = __webpack_require__(3); | ||
/** Used as references for various `Number` constants. */ | ||
var INFINITY = 1 / 0; | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
symbolToString = symbolProto ? symbolProto.toString : undefined; | ||
/** | ||
* The base implementation of `_.toString` which doesn't convert nullish | ||
* values to empty strings. | ||
* | ||
* @private | ||
* @param {*} value The value to process. | ||
* @returns {string} Returns the string. | ||
*/ | ||
function baseToString(value) { | ||
// Exit early for strings to avoid a performance hit in some environments. | ||
if (typeof value == 'string') { | ||
return value; | ||
} | ||
if (isArray(value)) { | ||
// Recursively convert values (susceptible to call stack limits). | ||
return arrayMap(value, baseToString) + ''; | ||
} | ||
if (isSymbol(value)) { | ||
return symbolToString ? symbolToString.call(value) : ''; | ||
} | ||
var result = (value + ''); | ||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
} | ||
module.exports = baseToString; | ||
/***/ }), | ||
/* 24 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArray = __webpack_require__(6), | ||
isKey = __webpack_require__(34), | ||
stringToPath = __webpack_require__(50), | ||
toString = __webpack_require__(60); | ||
/** | ||
* Casts `value` to a path array if it's not one. | ||
* | ||
* @private | ||
* @param {*} value The value to inspect. | ||
* @param {Object} [object] The object to query keys on. | ||
* @returns {Array} Returns the cast property path array. | ||
*/ | ||
function castPath(value, object) { | ||
if (isArray(value)) { | ||
return value; | ||
} | ||
return isKey(value, object) ? [value] : stringToPath(toString(value)); | ||
} | ||
module.exports = castPath; | ||
/***/ }), | ||
/* 25 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var root = __webpack_require__(5); | ||
/** Used to detect overreaching core-js shims. */ | ||
var coreJsData = root['__core-js_shared__']; | ||
module.exports = coreJsData; | ||
/***/ }), | ||
/* 26 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | ||
module.exports = freeGlobal; | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(61))) | ||
/***/ }), | ||
/* 27 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var Symbol = __webpack_require__(4); | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var nativeObjectToString = objectProto.toString; | ||
/** Built-in value references. */ | ||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined; | ||
/** | ||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {string} Returns the raw `toStringTag`. | ||
*/ | ||
function getRawTag(value) { | ||
var isOwn = hasOwnProperty.call(value, symToStringTag), | ||
tag = value[symToStringTag]; | ||
try { | ||
value[symToStringTag] = undefined; | ||
var unmasked = true; | ||
} catch (e) {} | ||
var result = nativeObjectToString.call(value); | ||
if (unmasked) { | ||
if (isOwn) { | ||
value[symToStringTag] = tag; | ||
} else { | ||
delete value[symToStringTag]; | ||
} | ||
} | ||
return result; | ||
} | ||
module.exports = getRawTag; | ||
/***/ }), | ||
/* 28 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Gets the value at `key` of `object`. | ||
* | ||
* @private | ||
* @param {Object} [object] The object to query. | ||
* @param {string} key The key of the property to get. | ||
* @returns {*} Returns the property value. | ||
*/ | ||
function getValue(object, key) { | ||
return object == null ? undefined : object[key]; | ||
} | ||
module.exports = getValue; | ||
/***/ }), | ||
/* 29 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var nativeCreate = __webpack_require__(2); | ||
/** | ||
* Removes all key-value entries from the hash. | ||
* | ||
* @private | ||
* @name clear | ||
* @memberOf Hash | ||
*/ | ||
function hashClear() { | ||
this.__data__ = nativeCreate ? nativeCreate(null) : {}; | ||
this.size = 0; | ||
} | ||
module.exports = hashClear; | ||
/***/ }), | ||
/* 30 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Removes `key` and its value from the hash. | ||
* | ||
* @private | ||
* @name delete | ||
* @memberOf Hash | ||
* @param {Object} hash The hash to modify. | ||
* @param {string} key The key of the value to remove. | ||
* @returns {boolean} Returns `true` if the entry was removed, else `false`. | ||
*/ | ||
function hashDelete(key) { | ||
var result = this.has(key) && delete this.__data__[key]; | ||
this.size -= result ? 1 : 0; | ||
return result; | ||
} | ||
module.exports = hashDelete; | ||
/***/ }), | ||
/* 31 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var nativeCreate = __webpack_require__(2); | ||
/** Used to stand-in for `undefined` hash values. */ | ||
var HASH_UNDEFINED = '__lodash_hash_undefined__'; | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Gets the hash value for `key`. | ||
* | ||
* @private | ||
* @name get | ||
* @memberOf Hash | ||
* @param {string} key The key of the value to get. | ||
* @returns {*} Returns the entry value. | ||
*/ | ||
function hashGet(key) { | ||
var data = this.__data__; | ||
if (nativeCreate) { | ||
var result = data[key]; | ||
return result === HASH_UNDEFINED ? undefined : result; | ||
} | ||
return hasOwnProperty.call(data, key) ? data[key] : undefined; | ||
} | ||
module.exports = hashGet; | ||
/***/ }), | ||
/* 32 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var nativeCreate = __webpack_require__(2); | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Checks if a hash value for `key` exists. | ||
* | ||
* @private | ||
* @name has | ||
* @memberOf Hash | ||
* @param {string} key The key of the entry to check. | ||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. | ||
*/ | ||
function hashHas(key) { | ||
var data = this.__data__; | ||
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); | ||
} | ||
module.exports = hashHas; | ||
/***/ }), | ||
/* 33 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var nativeCreate = __webpack_require__(2); | ||
/** Used to stand-in for `undefined` hash values. */ | ||
var HASH_UNDEFINED = '__lodash_hash_undefined__'; | ||
/** | ||
* Sets the hash `key` to `value`. | ||
* | ||
* @private | ||
* @name set | ||
* @memberOf Hash | ||
* @param {string} key The key of the value to set. | ||
* @param {*} value The value to set. | ||
* @returns {Object} Returns the hash instance. | ||
*/ | ||
function hashSet(key, value) { | ||
var data = this.__data__; | ||
this.size += this.has(key) ? 0 : 1; | ||
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; | ||
return this; | ||
} | ||
module.exports = hashSet; | ||
/***/ }), | ||
/* 34 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArray = __webpack_require__(6), | ||
isSymbol = __webpack_require__(3); | ||
/** Used to match property names within property paths. */ | ||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, | ||
reIsPlainProp = /^\w*$/; | ||
/** | ||
* Checks if `value` is a property name and not a property path. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @param {Object} [object] The object to query keys on. | ||
* @returns {boolean} Returns `true` if `value` is a property name, else `false`. | ||
*/ | ||
function isKey(value, object) { | ||
if (isArray(value)) { | ||
return false; | ||
} | ||
var type = typeof value; | ||
if (type == 'number' || type == 'symbol' || type == 'boolean' || | ||
value == null || isSymbol(value)) { | ||
return true; | ||
} | ||
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
(object != null && value in Object(object)); | ||
} | ||
module.exports = isKey; | ||
/***/ }), | ||
/* 35 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Checks if `value` is suitable for use as unique object key. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is suitable, else `false`. | ||
*/ | ||
function isKeyable(value) { | ||
var type = typeof value; | ||
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') | ||
? (value !== '__proto__') | ||
: (value === null); | ||
} | ||
module.exports = isKeyable; | ||
/***/ }), | ||
/* 36 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var coreJsData = __webpack_require__(25); | ||
/** Used to detect methods masquerading as native. */ | ||
var maskSrcKey = (function() { | ||
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); | ||
return uid ? ('Symbol(src)_1.' + uid) : ''; | ||
}()); | ||
/** | ||
* Checks if `func` has its source masked. | ||
* | ||
* @private | ||
* @param {Function} func The function to check. | ||
* @returns {boolean} Returns `true` if `func` is masked, else `false`. | ||
*/ | ||
function isMasked(func) { | ||
return !!maskSrcKey && (maskSrcKey in func); | ||
} | ||
module.exports = isMasked; | ||
/***/ }), | ||
/* 37 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Removes all key-value entries from the list cache. | ||
* | ||
* @private | ||
* @name clear | ||
* @memberOf ListCache | ||
*/ | ||
function listCacheClear() { | ||
this.__data__ = []; | ||
this.size = 0; | ||
} | ||
module.exports = listCacheClear; | ||
/***/ }), | ||
/* 38 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var assocIndexOf = __webpack_require__(0); | ||
/** Used for built-in method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Built-in value references. */ | ||
var splice = arrayProto.splice; | ||
/** | ||
* Removes `key` and its value from the list cache. | ||
* | ||
* @private | ||
* @name delete | ||
* @memberOf ListCache | ||
* @param {string} key The key of the value to remove. | ||
* @returns {boolean} Returns `true` if the entry was removed, else `false`. | ||
*/ | ||
function listCacheDelete(key) { | ||
var data = this.__data__, | ||
index = assocIndexOf(data, key); | ||
if (index < 0) { | ||
return false; | ||
} | ||
var lastIndex = data.length - 1; | ||
if (index == lastIndex) { | ||
data.pop(); | ||
} else { | ||
splice.call(data, index, 1); | ||
} | ||
--this.size; | ||
return true; | ||
} | ||
module.exports = listCacheDelete; | ||
/***/ }), | ||
/* 39 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var assocIndexOf = __webpack_require__(0); | ||
/** | ||
* Gets the list cache value for `key`. | ||
* | ||
* @private | ||
* @name get | ||
* @memberOf ListCache | ||
* @param {string} key The key of the value to get. | ||
* @returns {*} Returns the entry value. | ||
*/ | ||
function listCacheGet(key) { | ||
var data = this.__data__, | ||
index = assocIndexOf(data, key); | ||
return index < 0 ? undefined : data[index][1]; | ||
} | ||
module.exports = listCacheGet; | ||
/***/ }), | ||
/* 40 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var assocIndexOf = __webpack_require__(0); | ||
/** | ||
* Checks if a list cache value for `key` exists. | ||
* | ||
* @private | ||
* @name has | ||
* @memberOf ListCache | ||
* @param {string} key The key of the entry to check. | ||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. | ||
*/ | ||
function listCacheHas(key) { | ||
return assocIndexOf(this.__data__, key) > -1; | ||
} | ||
module.exports = listCacheHas; | ||
/***/ }), | ||
/* 41 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var assocIndexOf = __webpack_require__(0); | ||
/** | ||
* Sets the list cache `key` to `value`. | ||
* | ||
* @private | ||
* @name set | ||
* @memberOf ListCache | ||
* @param {string} key The key of the value to set. | ||
* @param {*} value The value to set. | ||
* @returns {Object} Returns the list cache instance. | ||
*/ | ||
function listCacheSet(key, value) { | ||
var data = this.__data__, | ||
index = assocIndexOf(data, key); | ||
if (index < 0) { | ||
++this.size; | ||
data.push([key, value]); | ||
} else { | ||
data[index][1] = value; | ||
} | ||
return this; | ||
} | ||
module.exports = listCacheSet; | ||
/***/ }), | ||
/* 42 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var Hash = __webpack_require__(13), | ||
ListCache = __webpack_require__(14), | ||
Map = __webpack_require__(15); | ||
/** | ||
* Removes all key-value entries from the map. | ||
* | ||
* @private | ||
* @name clear | ||
* @memberOf MapCache | ||
*/ | ||
function mapCacheClear() { | ||
this.size = 0; | ||
this.__data__ = { | ||
'hash': new Hash, | ||
'map': new (Map || ListCache), | ||
'string': new Hash | ||
}; | ||
} | ||
module.exports = mapCacheClear; | ||
/***/ }), | ||
/* 43 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var getMapData = __webpack_require__(1); | ||
/** | ||
* Removes `key` and its value from the map. | ||
* | ||
* @private | ||
* @name delete | ||
* @memberOf MapCache | ||
* @param {string} key The key of the value to remove. | ||
* @returns {boolean} Returns `true` if the entry was removed, else `false`. | ||
*/ | ||
function mapCacheDelete(key) { | ||
var result = getMapData(this, key)['delete'](key); | ||
this.size -= result ? 1 : 0; | ||
return result; | ||
} | ||
module.exports = mapCacheDelete; | ||
/***/ }), | ||
/* 44 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var getMapData = __webpack_require__(1); | ||
/** | ||
* Gets the map value for `key`. | ||
* | ||
* @private | ||
* @name get | ||
* @memberOf MapCache | ||
* @param {string} key The key of the value to get. | ||
* @returns {*} Returns the entry value. | ||
*/ | ||
function mapCacheGet(key) { | ||
return getMapData(this, key).get(key); | ||
} | ||
module.exports = mapCacheGet; | ||
/***/ }), | ||
/* 45 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var getMapData = __webpack_require__(1); | ||
/** | ||
* Checks if a map value for `key` exists. | ||
* | ||
* @private | ||
* @name has | ||
* @memberOf MapCache | ||
* @param {string} key The key of the entry to check. | ||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. | ||
*/ | ||
function mapCacheHas(key) { | ||
return getMapData(this, key).has(key); | ||
} | ||
module.exports = mapCacheHas; | ||
/***/ }), | ||
/* 46 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var getMapData = __webpack_require__(1); | ||
/** | ||
* Sets the map `key` to `value`. | ||
* | ||
* @private | ||
* @name set | ||
* @memberOf MapCache | ||
* @param {string} key The key of the value to set. | ||
* @param {*} value The value to set. | ||
* @returns {Object} Returns the map cache instance. | ||
*/ | ||
function mapCacheSet(key, value) { | ||
var data = getMapData(this, key), | ||
size = data.size; | ||
data.set(key, value); | ||
this.size += data.size == size ? 0 : 1; | ||
return this; | ||
} | ||
module.exports = mapCacheSet; | ||
/***/ }), | ||
/* 47 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var memoize = __webpack_require__(56); | ||
/** Used as the maximum memoize cache size. */ | ||
var MAX_MEMOIZE_SIZE = 500; | ||
/** | ||
* A specialized version of `_.memoize` which clears the memoized function's | ||
* cache when it exceeds `MAX_MEMOIZE_SIZE`. | ||
* | ||
* @private | ||
* @param {Function} func The function to have its output memoized. | ||
* @returns {Function} Returns the new memoized function. | ||
*/ | ||
function memoizeCapped(func) { | ||
var result = memoize(func, function(key) { | ||
if (cache.size === MAX_MEMOIZE_SIZE) { | ||
cache.clear(); | ||
} | ||
return key; | ||
}); | ||
var cache = result.cache; | ||
return result; | ||
} | ||
module.exports = memoizeCapped; | ||
/***/ }), | ||
/* 48 */ | ||
/***/ (function(module, exports) { | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var nativeObjectToString = objectProto.toString; | ||
/** | ||
* Converts `value` to a string using `Object.prototype.toString`. | ||
* | ||
* @private | ||
* @param {*} value The value to convert. | ||
* @returns {string} Returns the converted string. | ||
*/ | ||
function objectToString(value) { | ||
return nativeObjectToString.call(value); | ||
} | ||
module.exports = objectToString; | ||
/***/ }), | ||
/* 49 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* A specialized version of `_.indexOf` which performs strict equality | ||
* comparisons of values, i.e. `===`. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {*} value The value to search for. | ||
* @param {number} fromIndex The index to search from. | ||
* @returns {number} Returns the index of the matched value, else `-1`. | ||
*/ | ||
function strictIndexOf(array, value, fromIndex) { | ||
var index = fromIndex - 1, | ||
length = array.length; | ||
while (++index < length) { | ||
if (array[index] === value) { | ||
return index; | ||
} | ||
} | ||
return -1; | ||
} | ||
module.exports = strictIndexOf; | ||
/***/ }), | ||
/* 50 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var memoizeCapped = __webpack_require__(47); | ||
/** Used to match property names within property paths. */ | ||
var reLeadingDot = /^\./, | ||
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; | ||
/** Used to match backslashes in property paths. */ | ||
var reEscapeChar = /\\(\\)?/g; | ||
/** | ||
* Converts `string` to a property path array. | ||
* | ||
* @private | ||
* @param {string} string The string to convert. | ||
* @returns {Array} Returns the property path array. | ||
*/ | ||
var stringToPath = memoizeCapped(function(string) { | ||
var result = []; | ||
if (reLeadingDot.test(string)) { | ||
result.push(''); | ||
} | ||
string.replace(rePropName, function(match, number, quote, string) { | ||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); | ||
}); | ||
return result; | ||
}); | ||
module.exports = stringToPath; | ||
/***/ }), | ||
/* 51 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isSymbol = __webpack_require__(3); | ||
/** Used as references for various `Number` constants. */ | ||
var INFINITY = 1 / 0; | ||
/** | ||
* Converts `value` to a string key if it's not a string or symbol. | ||
* | ||
* @private | ||
* @param {*} value The value to inspect. | ||
* @returns {string|symbol} Returns the key. | ||
*/ | ||
function toKey(value) { | ||
if (typeof value == 'string' || isSymbol(value)) { | ||
return value; | ||
} | ||
var result = (value + ''); | ||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
} | ||
module.exports = toKey; | ||
/***/ }), | ||
/* 52 */ | ||
/***/ (function(module, exports) { | ||
/** Used for built-in method references. */ | ||
var funcProto = Function.prototype; | ||
/** Used to resolve the decompiled source of functions. */ | ||
var funcToString = funcProto.toString; | ||
/** | ||
* Converts `func` to its source code. | ||
* | ||
* @private | ||
* @param {Function} func The function to convert. | ||
* @returns {string} Returns the source code. | ||
*/ | ||
function toSource(func) { | ||
if (func != null) { | ||
try { | ||
return funcToString.call(func); | ||
} catch (e) {} | ||
try { | ||
return (func + ''); | ||
} catch (e) {} | ||
} | ||
return ''; | ||
} | ||
module.exports = toSource; | ||
/***/ }), | ||
/* 53 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Performs a | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | ||
* comparison between two values to determine if they are equivalent. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to compare. | ||
* @param {*} other The other value to compare. | ||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`. | ||
* @example | ||
* | ||
* var object = { 'a': 1 }; | ||
* var other = { 'a': 1 }; | ||
* | ||
* _.eq(object, object); | ||
* // => true | ||
* | ||
* _.eq(object, other); | ||
* // => false | ||
* | ||
* _.eq('a', 'a'); | ||
* // => true | ||
* | ||
* _.eq('a', Object('a')); | ||
* // => false | ||
* | ||
* _.eq(NaN, NaN); | ||
* // => true | ||
*/ | ||
function eq(value, other) { | ||
return value === other || (value !== value && other !== other); | ||
} | ||
module.exports = eq; | ||
/***/ }), | ||
/* 54 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseGetTag = __webpack_require__(8), | ||
isObject = __webpack_require__(7); | ||
/** `Object#toString` result references. */ | ||
var asyncTag = '[object AsyncFunction]', | ||
funcTag = '[object Function]', | ||
genTag = '[object GeneratorFunction]', | ||
proxyTag = '[object Proxy]'; | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a function, else `false`. | ||
* @example | ||
* | ||
* _.isFunction(_); | ||
* // => true | ||
* | ||
* _.isFunction(/abc/); | ||
* // => false | ||
*/ | ||
function isFunction(value) { | ||
if (!isObject(value)) { | ||
return false; | ||
} | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in Safari 9 which returns 'object' for typed arrays and other constructors. | ||
var tag = baseGetTag(value); | ||
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; | ||
} | ||
module.exports = isFunction; | ||
/***/ }), | ||
/* 55 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return value != null && typeof value == 'object'; | ||
} | ||
module.exports = isObjectLike; | ||
/***/ }), | ||
/* 56 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var MapCache = __webpack_require__(16); | ||
/** Error message constants. */ | ||
var FUNC_ERROR_TEXT = 'Expected a function'; | ||
/** | ||
* Creates a function that memoizes the result of `func`. If `resolver` is | ||
* provided, it determines the cache key for storing the result based on the | ||
* arguments provided to the memoized function. By default, the first argument | ||
* provided to the memoized function is used as the map cache key. The `func` | ||
* is invoked with the `this` binding of the memoized function. | ||
* | ||
* **Note:** The cache is exposed as the `cache` property on the memoized | ||
* function. Its creation may be customized by replacing the `_.memoize.Cache` | ||
* constructor with one whose instances implement the | ||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) | ||
* method interface of `clear`, `delete`, `get`, `has`, and `set`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Function | ||
* @param {Function} func The function to have its output memoized. | ||
* @param {Function} [resolver] The function to resolve the cache key. | ||
* @returns {Function} Returns the new memoized function. | ||
* @example | ||
* | ||
* var object = { 'a': 1, 'b': 2 }; | ||
* var other = { 'c': 3, 'd': 4 }; | ||
* | ||
* var values = _.memoize(_.values); | ||
* values(object); | ||
* // => [1, 2] | ||
* | ||
* values(other); | ||
* // => [3, 4] | ||
* | ||
* object.a = 2; | ||
* values(object); | ||
* // => [1, 2] | ||
* | ||
* // Modify the result cache. | ||
* values.cache.set(object, ['a', 'b']); | ||
* values(object); | ||
* // => ['a', 'b'] | ||
* | ||
* // Replace `_.memoize.Cache`. | ||
* _.memoize.Cache = WeakMap; | ||
*/ | ||
function memoize(func, resolver) { | ||
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
} | ||
var memoized = function() { | ||
var args = arguments, | ||
key = resolver ? resolver.apply(this, args) : args[0], | ||
cache = memoized.cache; | ||
if (cache.has(key)) { | ||
return cache.get(key); | ||
} | ||
var result = func.apply(this, args); | ||
memoized.cache = cache.set(key, result) || cache; | ||
return result; | ||
}; | ||
memoized.cache = new (memoize.Cache || MapCache); | ||
return memoized; | ||
} | ||
// Expose `MapCache`. | ||
memoize.Cache = MapCache; | ||
module.exports = memoize; | ||
/***/ }), | ||
/* 57 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toNumber = __webpack_require__(59); | ||
/** Used as references for various `Number` constants. */ | ||
var INFINITY = 1 / 0, | ||
MAX_INTEGER = 1.7976931348623157e+308; | ||
/** | ||
* Converts `value` to a finite number. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.12.0 | ||
* @category Lang | ||
* @param {*} value The value to convert. | ||
* @returns {number} Returns the converted number. | ||
* @example | ||
* | ||
* _.toFinite(3.2); | ||
* // => 3.2 | ||
* | ||
* _.toFinite(Number.MIN_VALUE); | ||
* // => 5e-324 | ||
* | ||
* _.toFinite(Infinity); | ||
* // => 1.7976931348623157e+308 | ||
* | ||
* _.toFinite('3.2'); | ||
* // => 3.2 | ||
*/ | ||
function toFinite(value) { | ||
if (!value) { | ||
return value === 0 ? value : 0; | ||
} | ||
value = toNumber(value); | ||
if (value === INFINITY || value === -INFINITY) { | ||
var sign = (value < 0 ? -1 : 1); | ||
return sign * MAX_INTEGER; | ||
} | ||
return value === value ? value : 0; | ||
} | ||
module.exports = toFinite; | ||
/***/ }), | ||
/* 58 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toFinite = __webpack_require__(57); | ||
/** | ||
* Converts `value` to an integer. | ||
* | ||
* **Note:** This method is loosely based on | ||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* | ||
* _.toInteger(3.2); | ||
* // => 3 | ||
* | ||
* _.toInteger(Number.MIN_VALUE); | ||
* // => 0 | ||
* | ||
* _.toInteger(Infinity); | ||
* // => 1.7976931348623157e+308 | ||
* | ||
* _.toInteger('3.2'); | ||
* // => 3 | ||
*/ | ||
function toInteger(value) { | ||
var result = toFinite(value), | ||
remainder = result % 1; | ||
return result === result ? (remainder ? result - remainder : result) : 0; | ||
} | ||
module.exports = toInteger; | ||
/***/ }), | ||
/* 59 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isObject = __webpack_require__(7), | ||
isSymbol = __webpack_require__(3); | ||
/** Used as references for various `Number` constants. */ | ||
var NAN = 0 / 0; | ||
/** Used to match leading and trailing whitespace. */ | ||
var reTrim = /^\s+|\s+$/g; | ||
/** Used to detect bad signed hexadecimal string values. */ | ||
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; | ||
/** Used to detect binary string values. */ | ||
var reIsBinary = /^0b[01]+$/i; | ||
/** Used to detect octal string values. */ | ||
var reIsOctal = /^0o[0-7]+$/i; | ||
/** Built-in method references without a dependency on `root`. */ | ||
var freeParseInt = parseInt; | ||
/** | ||
* Converts `value` to a number. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to process. | ||
* @returns {number} Returns the number. | ||
* @example | ||
* | ||
* _.toNumber(3.2); | ||
* // => 3.2 | ||
* | ||
* _.toNumber(Number.MIN_VALUE); | ||
* // => 5e-324 | ||
* | ||
* _.toNumber(Infinity); | ||
* // => Infinity | ||
* | ||
* _.toNumber('3.2'); | ||
* // => 3.2 | ||
*/ | ||
function toNumber(value) { | ||
if (typeof value == 'number') { | ||
return value; | ||
} | ||
if (isSymbol(value)) { | ||
return NAN; | ||
} | ||
if (isObject(value)) { | ||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value; | ||
value = isObject(other) ? (other + '') : other; | ||
} | ||
if (typeof value != 'string') { | ||
return value === 0 ? value : +value; | ||
} | ||
value = value.replace(reTrim, ''); | ||
var isBinary = reIsBinary.test(value); | ||
return (isBinary || reIsOctal.test(value)) | ||
? freeParseInt(value.slice(2), isBinary ? 2 : 8) | ||
: (reIsBadHex.test(value) ? NAN : +value); | ||
} | ||
module.exports = toNumber; | ||
/***/ }), | ||
/* 60 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var baseToString = __webpack_require__(23); | ||
/** | ||
* Converts `value` to a string. An empty string is returned for `null` | ||
* and `undefined` values. The sign of `-0` is preserved. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to convert. | ||
* @returns {string} Returns the converted string. | ||
* @example | ||
* | ||
* _.toString(null); | ||
* // => '' | ||
* | ||
* _.toString(-0); | ||
* // => '-0' | ||
* | ||
* _.toString([1, 2, 3]); | ||
* // => '1,2,3' | ||
*/ | ||
function toString(value) { | ||
return value == null ? '' : baseToString(value); | ||
} | ||
module.exports = toString; | ||
/***/ }), | ||
/* 61 */ | ||
/***/ (function(module, exports) { | ||
var g; | ||
// This works in non-strict mode | ||
g = (function() { | ||
return this; | ||
})(); | ||
try { | ||
// This works if eval is allowed (see CSP) | ||
g = g || Function("return this")() || (1,eval)("this"); | ||
} catch(e) { | ||
// This works if the window reference is available | ||
if(typeof window === "object") | ||
g = window; | ||
} | ||
// g can still be undefined, but nothing to do about it... | ||
// We return undefined, instead of nothing here, so it's | ||
// easier to handle this case. if(!global) { ...} | ||
module.exports = g; | ||
/***/ }) | ||
@@ -2056,0 +154,0 @@ /******/ ]); |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.reduxStateSync=n():t.reduxStateSync=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.i=function(t){return t},n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=12)}([function(t,n,r){function e(t,n){for(var r=t.length;r--;)if(o(t[r][0],n))return r;return-1}var o=r(53);t.exports=e},function(t,n,r){function e(t,n){var r=t.__data__;return o(n)?r["string"==typeof n?"string":"hash"]:r.map}var o=r(35);t.exports=e},function(t,n,r){var e=r(9),o=e(Object,"create");t.exports=o},function(t,n,r){function e(t){return"symbol"==typeof t||i(t)&&o(t)==u}var o=r(8),i=r(55),u="[object Symbol]";t.exports=e},function(t,n,r){var e=r(5),o=e.Symbol;t.exports=o},function(t,n,r){var e=r(26),o="object"==typeof self&&self&&self.Object===Object&&self,i=e||o||Function("return this")();t.exports=i},function(t,n){var r=Array.isArray;t.exports=r},function(t,n){function r(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}t.exports=r},function(t,n,r){function e(t){return null==t?void 0===t?a:c:f&&f in Object(t)?i(t):u(t)}var o=r(4),i=r(27),u=r(48),c="[object Null]",a="[object Undefined]",f=o?o.toStringTag:void 0;t.exports=e},function(t,n,r){function e(t,n){var r=i(t,n);return o(r)?r:void 0}var o=r(22),i=r(28);t.exports=e},function(t,n,r){function e(t,n,r){var e=null==t?void 0:o(t,n);return void 0===e?r:e}var o=r(19);t.exports=e},function(t,n,r){function e(t,n,r){var e=null==t?0:t.length;if(!e)return-1;var c=null==r?0:i(r);return c<0&&(c=u(e+c,0)),o(t,n,c)}var o=r(20),i=r(58),u=Math.max;t.exports=e},function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{default:t}}function o(t){var n=t;return n.$time=Date.now(),{stampedAction:n}}function i(t,n){var r=[];n&&(r=(0,f.default)(n,"ignore",[])),window.addEventListener("storage",function(n){var e=JSON.parse(n.newValue),o=e.stampedAction;o&&o.$time!==s&&(0,c.default)(r,o.type)<0&&(s=o.$time,t.dispatch(o))})}Object.defineProperty(n,"__esModule",{value:!0}),n.actionStorageMiddleware=void 0,n.timestampAction=o,n.createStorageListener=i;var u=r(11),c=e(u),a=r(10),f=e(a),s=0;n.actionStorageMiddleware=function(){return function(t){return function(n){if(n&&!n.$time)try{var r=o(n);s=r.$time,localStorage.setItem("LAST_ACTION",JSON.stringify(r))}catch(t){console.log("Your browser doesn't support localStorage")}return t(n)}}}},function(t,n,r){function e(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}var o=r(29),i=r(30),u=r(31),c=r(32),a=r(33);e.prototype.clear=o,e.prototype.delete=i,e.prototype.get=u,e.prototype.has=c,e.prototype.set=a,t.exports=e},function(t,n,r){function e(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}var o=r(37),i=r(38),u=r(39),c=r(40),a=r(41);e.prototype.clear=o,e.prototype.delete=i,e.prototype.get=u,e.prototype.has=c,e.prototype.set=a,t.exports=e},function(t,n,r){var e=r(9),o=r(5),i=e(o,"Map");t.exports=i},function(t,n,r){function e(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}var o=r(42),i=r(43),u=r(44),c=r(45),a=r(46);e.prototype.clear=o,e.prototype.delete=i,e.prototype.get=u,e.prototype.has=c,e.prototype.set=a,t.exports=e},function(t,n){function r(t,n){for(var r=-1,e=null==t?0:t.length,o=Array(e);++r<e;)o[r]=n(t[r],r,t);return o}t.exports=r},function(t,n){function r(t,n,r,e){for(var o=t.length,i=r+(e?1:-1);e?i--:++i<o;)if(n(t[i],i,t))return i;return-1}t.exports=r},function(t,n,r){function e(t,n){n=o(n,t);for(var r=0,e=n.length;null!=t&&r<e;)t=t[i(n[r++])];return r&&r==e?t:void 0}var o=r(24),i=r(51);t.exports=e},function(t,n,r){function e(t,n,r){return n===n?u(t,n,r):o(t,i,r)}var o=r(18),i=r(21),u=r(49);t.exports=e},function(t,n){function r(t){return t!==t}t.exports=r},function(t,n,r){function e(t){return!(!u(t)||i(t))&&(o(t)?v:a).test(c(t))}var o=r(54),i=r(36),u=r(7),c=r(52),a=/^\[object .+?Constructor\]$/,f=Function.prototype,s=Object.prototype,p=f.toString,l=s.hasOwnProperty,v=RegExp("^"+p.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=e},function(t,n,r){function e(t){if("string"==typeof t)return t;if(u(t))return i(t,e)+"";if(c(t))return s?s.call(t):"";var n=t+"";return"0"==n&&1/t==-a?"-0":n}var o=r(4),i=r(17),u=r(6),c=r(3),a=1/0,f=o?o.prototype:void 0,s=f?f.toString:void 0;t.exports=e},function(t,n,r){function e(t,n){return o(t)?t:i(t,n)?[t]:u(c(t))}var o=r(6),i=r(34),u=r(50),c=r(60);t.exports=e},function(t,n,r){var e=r(5),o=e["__core-js_shared__"];t.exports=o},function(t,n,r){(function(n){var r="object"==typeof n&&n&&n.Object===Object&&n;t.exports=r}).call(n,r(61))},function(t,n,r){function e(t){var n=u.call(t,a),r=t[a];try{t[a]=void 0}catch(t){}var e=c.call(t);return n?t[a]=r:delete t[a],e}var o=r(4),i=Object.prototype,u=i.hasOwnProperty,c=i.toString,a=o?o.toStringTag:void 0;t.exports=e},function(t,n){function r(t,n){return null==t?void 0:t[n]}t.exports=r},function(t,n,r){function e(){this.__data__=o?o(null):{},this.size=0}var o=r(2);t.exports=e},function(t,n){function r(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}t.exports=r},function(t,n,r){function e(t){var n=this.__data__;if(o){var r=n[t];return r===i?void 0:r}return c.call(n,t)?n[t]:void 0}var o=r(2),i="__lodash_hash_undefined__",u=Object.prototype,c=u.hasOwnProperty;t.exports=e},function(t,n,r){function e(t){var n=this.__data__;return o?void 0!==n[t]:u.call(n,t)}var o=r(2),i=Object.prototype,u=i.hasOwnProperty;t.exports=e},function(t,n,r){function e(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=o&&void 0===n?i:n,this}var o=r(2),i="__lodash_hash_undefined__";t.exports=e},function(t,n,r){function e(t,n){if(o(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!i(t))||(c.test(t)||!u.test(t)||null!=n&&t in Object(n))}var o=r(6),i=r(3),u=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/;t.exports=e},function(t,n){function r(t){var n=typeof t;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==t:null===t}t.exports=r},function(t,n,r){function e(t){return!!i&&i in t}var o=r(25),i=function(){var t=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=e},function(t,n){function r(){this.__data__=[],this.size=0}t.exports=r},function(t,n,r){function e(t){var n=this.__data__,r=o(n,t);return!(r<0)&&(r==n.length-1?n.pop():u.call(n,r,1),--this.size,!0)}var o=r(0),i=Array.prototype,u=i.splice;t.exports=e},function(t,n,r){function e(t){var n=this.__data__,r=o(n,t);return r<0?void 0:n[r][1]}var o=r(0);t.exports=e},function(t,n,r){function e(t){return o(this.__data__,t)>-1}var o=r(0);t.exports=e},function(t,n,r){function e(t,n){var r=this.__data__,e=o(r,t);return e<0?(++this.size,r.push([t,n])):r[e][1]=n,this}var o=r(0);t.exports=e},function(t,n,r){function e(){this.size=0,this.__data__={hash:new o,map:new(u||i),string:new o}}var o=r(13),i=r(14),u=r(15);t.exports=e},function(t,n,r){function e(t){var n=o(this,t).delete(t);return this.size-=n?1:0,n}var o=r(1);t.exports=e},function(t,n,r){function e(t){return o(this,t).get(t)}var o=r(1);t.exports=e},function(t,n,r){function e(t){return o(this,t).has(t)}var o=r(1);t.exports=e},function(t,n,r){function e(t,n){var r=o(this,t),e=r.size;return r.set(t,n),this.size+=r.size==e?0:1,this}var o=r(1);t.exports=e},function(t,n,r){function e(t){var n=o(t,function(t){return r.size===i&&r.clear(),t}),r=n.cache;return n}var o=r(56),i=500;t.exports=e},function(t,n){function r(t){return o.call(t)}var e=Object.prototype,o=e.toString;t.exports=r},function(t,n){function r(t,n,r){for(var e=r-1,o=t.length;++e<o;)if(t[e]===n)return e;return-1}t.exports=r},function(t,n,r){var e=r(47),o=/^\./,i=e(function(t){var n=[];return o.test(t)&&n.push(""),t.replace(/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,function(t,r,e,o){n.push(e?o.replace(/\\(\\)?/g,"$1"):r||t)}),n});t.exports=i},function(t,n,r){function e(t){if("string"==typeof t||o(t))return t;var n=t+"";return"0"==n&&1/t==-i?"-0":n}var o=r(3),i=1/0;t.exports=e},function(t,n){function r(t){if(null!=t){try{return o.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var e=Function.prototype,o=e.toString;t.exports=r},function(t,n){function r(t,n){return t===n||t!==t&&n!==n}t.exports=r},function(t,n,r){function e(t){if(!i(t))return!1;var n=o(t);return n==c||n==a||n==u||n==f}var o=r(8),i=r(7),u="[object AsyncFunction]",c="[object Function]",a="[object GeneratorFunction]",f="[object Proxy]";t.exports=e},function(t,n){function r(t){return null!=t&&"object"==typeof t}t.exports=r},function(t,n,r){function e(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError(i);var r=function(){var e=arguments,o=n?n.apply(this,e):e[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,e);return r.cache=i.set(o,u)||i,u};return r.cache=new(e.Cache||o),r}var o=r(16),i="Expected a function";e.Cache=o,t.exports=e},function(t,n,r){function e(t){if(!t)return 0===t?t:0;if((t=o(t))===i||t===-i){return(t<0?-1:1)*u}return t===t?t:0}var o=r(59),i=1/0,u=1.7976931348623157e308;t.exports=e},function(t,n,r){function e(t){var n=o(t),r=n%1;return n===n?r?n-r:n:0}var o=r(57);t.exports=e},function(t,n,r){function e(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=o(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(c,"");var r=f.test(t);return r||s.test(t)?p(t.slice(2),r?2:8):a.test(t)?u:+t}var o=r(7),i=r(3),u=NaN,c=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,s=/^0o[0-7]+$/i,p=parseInt;t.exports=e},function(t,n,r){function e(t){return null==t?"":o(t)}var o=r(23);t.exports=e},function(t,n){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.reduxStateSync=t():e.reduxStateSync=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";function n(e){var t=e;return t.$time=Date.now(),{stampedAction:t}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=function(){return!0};t.predicate&&"function"==typeof t.predicate?r=t.predicate:Array.isArray(t.ignore)&&(r=function(e){return t.ignore.indexOf(e)>=0}),window.addEventListener("storage",function(t){var n=JSON.parse(t.newValue),o=n.stampedAction;o&&o.$time!==i&&r(o.type)&&(i=o.$time,e.dispatch(o))})}Object.defineProperty(t,"__esModule",{value:!0}),t.timestampAction=n,t.createStorageListener=o;var i=0;t.actionStorageMiddleware=function(){return function(e){return function(t){if(t&&!t.$time)try{var r=n(t);i=r.$time,localStorage.setItem("LAST_ACTION",JSON.stringify(r))}catch(e){console.error("Your browser doesn't support localStorage")}return e(t)}}}}])}); | ||
//# sourceMappingURL=syncStorage.umd.min.js.map |
{ | ||
"name": "redux-state-sync", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "A middleware for redux to sync state in different tabs", | ||
@@ -5,0 +5,0 @@ "main": "dist/syncStorage.js", |
@@ -16,3 +16,2 @@ # Redux-State-Sync | ||
### How to use | ||
@@ -77,1 +76,9 @@ | ||
``` | ||
Thanks to Olebedev(https://github.com/olebedev), we now have another option to ignore the actions which you don't want to trigger. You can simply add a predicate function in the config object. This option will appeared in the new release. | ||
``` | ||
const config = { | ||
predicate: actionType => actionType !== 'GET_REPO', | ||
}; | ||
``` |
@@ -1,4 +0,1 @@ | ||
import indexOf from 'lodash/indexOf'; | ||
import get from 'lodash/get'; | ||
/* global window localStorage true */ | ||
@@ -23,3 +20,3 @@ let lastTimeStamp = 0; | ||
} catch (e) { | ||
console.log("Your browser doesn't support localStorage"); | ||
console.error("Your browser doesn't support localStorage"); | ||
} | ||
@@ -30,13 +27,14 @@ } | ||
export function createStorageListener(store, config) { | ||
let ignore = []; | ||
if (config) { | ||
ignore = get(config, 'ignore', []); | ||
export function createStorageListener(store, config = {}) { | ||
let allowed = () => true; | ||
if (config.predicate && typeof config.predicate === 'function') { | ||
allowed = config.predicate; | ||
} else if (Array.isArray(config.ignore)) { | ||
allowed = type => config.ignore.indexOf(type) >= 0; | ||
} | ||
window.addEventListener('storage', (event) => { | ||
const { stampedAction } = JSON.parse(event.newValue); | ||
if (stampedAction | ||
&& stampedAction.$time | ||
!== lastTimeStamp | ||
&& indexOf(ignore, stampedAction.type) < 0) { | ||
if (stampedAction && stampedAction.$time !== lastTimeStamp && !!allowed(stampedAction.type)) { | ||
lastTimeStamp = stampedAction.$time; | ||
@@ -43,0 +41,0 @@ store.dispatch(stampedAction); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16
83
203261
294