mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-26 11:33:54 +03:00
10bf7bc084
* chore(*): upgrade prettier * chore(*): upgrade prettier
33 lines
642 B
JavaScript
33 lines
642 B
JavaScript
function mark(data, type, transformMethod) {
|
|
return {
|
|
data: transformMethod ? data[transformMethod]() : data,
|
|
__serializedType__: type,
|
|
};
|
|
}
|
|
|
|
function extract(data, type) {
|
|
return {
|
|
data: Object.assign({}, data),
|
|
__serializedType__: type,
|
|
};
|
|
}
|
|
|
|
function refer(data, type, isArray, refs) {
|
|
var r = mark(data, type, isArray);
|
|
if (!refs) return r;
|
|
for (var i = 0; i < refs.length; i++) {
|
|
var ref = refs[i];
|
|
if (typeof ref === 'function' && data instanceof ref) {
|
|
r.__serializedRef__ = i;
|
|
return r;
|
|
}
|
|
}
|
|
return r;
|
|
}
|
|
|
|
module.exports = {
|
|
mark: mark,
|
|
extract: extract,
|
|
refer: refer,
|
|
};
|