qcobjects
Version:
QCObjects is an Open-source framework that empowers full-stack developers to make micro-services and micro-frontends into an N-Tier architecture.
28 lines (26 loc) • 789 B
text/typescript
import { __is_raw_class__ } from "./is_raw_class";
export const _LegacyCopy = function (obj:any, _ignore?:string[]):any {
let _value_;
switch (true) {
case typeof obj === "string":
_value_ = obj;
break;
case typeof obj === "number":
_value_ = obj;
break;
case typeof obj === "object":
_value_ = [{...Object.keys(obj).filter(k => !_ignore?.includes(k))}]
.map(k => {return {[k as never]:obj[k as never]}; })
.reduce ((p, c) => Object.assign(p, c)) as any;
break;
case typeof obj === "function":
_value_ = obj.bind({});
break;
case __is_raw_class__(obj):
_value_ = class extends obj { };
break;
default:
break;
}
return _value_;
};