@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
44 lines (43 loc) • 1.13 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as r from "react";
const f = (n) => n ? new Date(n.getTime()) : null;
function p(n) {
const e = {};
return o(n, e), e;
}
function o(n, e) {
for (const t in n)
if (!(t === "__proto__" || t === "constructor" || t === "prototype") && n.hasOwnProperty(t)) {
const i = n[t];
e[t] = c(i, e[t]);
}
}
function c(n, e) {
if (Array.isArray(n))
return s(n);
if (n instanceof Date)
return f(n);
if (r.isValidElement(n))
return r.cloneElement(n, n.props);
if (n && typeof n == "object") {
const t = e || {};
return o(n, t), t;
}
return n;
}
function s(n) {
return n.map((e) => c(e, void 0));
}
export {
p as clone,
s as cloneArray,
f as cloneDate,
o as cloneObject,
c as cloneValue
};