redux-behavior-subject
Version:
Create simple store with behavior subject and track changes by demand with [Redux DevTools](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en) for better performance only when you set to debug (set session s
35 lines (34 loc) • 803 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* change only the reference of the object
* @param obj
*/
function shallowCopy(obj) {
if (obj.constructor == Object) {
return Object.assign({}, obj);
}
else if (obj.constructor == Array) {
return [...obj];
}
return obj;
}
exports.shallowCopy = shallowCopy;
/**
* parsing the stack and get the caller name
* very heavy on cpu use it only in debug mode
*/
function callerNameByException() {
try {
throw new Error();
}
catch (e) {
try {
return e.stack.split("at ")[3].split(" ")[0];
}
catch (e) {
return "";
}
}
}
exports.callerNameByException = callerNameByException;