remotedev-utils
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -13,2 +13,3 @@ 'use strict'; | ||
exports.stringify = stringify; | ||
exports.getSeralizeParameter = getSeralizeParameter; | ||
@@ -27,2 +28,6 @@ var _getParams = require('get-params'); | ||
var _serialize = require('remotedev-serialize/immutable/serialize'); | ||
var _serialize2 = _interopRequireDefault(_serialize); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -133,2 +138,25 @@ | ||
return _jsan2.default.stringify(obj, serialize.replacer, null, serialize.options); | ||
} | ||
function getSeralizeParameter(config, param) { | ||
var serialize = config.serialize; | ||
if (serialize) { | ||
if (serialize === true) return { options: true }; | ||
if (serialize.immutable) { | ||
return { | ||
replacer: (0, _serialize2.default)(serialize.immutable, serialize.refs).replacer, | ||
options: serialize.options || true | ||
}; | ||
} | ||
if (!serialize.replacer) return { options: serialize.options }; | ||
return { replacer: serialize.replacer, options: serialize.options || true }; | ||
} | ||
var value = config[param]; | ||
if (typeof value === 'undefined') return undefined; | ||
console.warn('`' + param + '` parameter for Redux DevTools Extension is deprecated. Use `serialize` parameter instead: https://github.com/zalmoxisus/redux-devtools-extension/releases/tag/v2.12.1'); // eslint-disable-line | ||
if (typeof serializeState === 'boolean') return { options: value }; | ||
if (typeof serializeState === 'function') return { replacer: value }; | ||
return value; | ||
} |
{ | ||
"name": "remotedev-utils", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Utils for remotedev infrastructure", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
import getParams from 'get-params'; | ||
import jsan from 'jsan'; | ||
import shortid from 'shortid'; | ||
import seralizeImmutable from 'remotedev-serialize/immutable/serialize'; | ||
@@ -105,1 +106,24 @@ export function generateId(id) { | ||
} | ||
export function getSeralizeParameter(config, param) { | ||
const serialize = config.serialize; | ||
if (serialize) { | ||
if (serialize === true) return { options: true }; | ||
if (serialize.immutable) { | ||
return { | ||
replacer: seralizeImmutable(serialize.immutable, serialize.refs).replacer, | ||
options: serialize.options || true | ||
}; | ||
} | ||
if (!serialize.replacer) return { options: serialize.options }; | ||
return { replacer: serialize.replacer, options: serialize.options || true }; | ||
} | ||
const value = config[param]; | ||
if (typeof value === 'undefined') return undefined; | ||
console.warn(`\`${param}\` parameter for Redux DevTools Extension is deprecated. Use \`serialize\` parameter instead: https://github.com/zalmoxisus/redux-devtools-extension/releases/tag/v2.12.1`); // eslint-disable-line | ||
if (typeof serializeState === 'boolean') return { options: value }; | ||
if (typeof serializeState === 'function') return { replacer: value }; | ||
return value; | ||
} |
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
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
28876
633