@pixpilot/object 1.1.5 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -0,0 +1 @@
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@fastify/deepmerge`);t=e.__toESM(t);let n=null;function r(){return n||=(0,t.default)(),n}function i(...e){if(e.length===0)return{};if(e.length===1)return e[0]??{};let t={};for(let n of e)t=r()(t,n);return t}function a(e,t){return r()(e,t)}exports.deepMerge=a,exports.deepMergeMany=i;
@@ -0,0 +1,35 @@
1
+ //#region src/deep-merge.d.ts
2
+ /**
3
+ * Deep merge multiple objects.
4
+ *
5
+ * Uses @fastify/deepmerge to merge any number of objects into a single result.
6
+ * Objects are merged from left to right, with later objects overriding earlier ones.
7
+ *
8
+ * @param objects - The objects to merge
9
+ * @returns A new merged object
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const obj1 = { a: 1, b: { c: 2 } };
14
+ * const obj2 = { b: { d: 3 }, e: 4 };
15
+ * const obj3 = { e: 5, f: 6 };
16
+ * deepMergeMany(obj1, obj2, obj3); // { a: 1, b: { c: 2, d: 3 }, e: 5, f: 6 }
17
+ * ```
18
+ */
19
+ declare function deepMergeMany<T extends Record<string, unknown>>(...objects: T[]): Record<string, unknown>;
20
+ /**
21
+ * Re-export the configured deepmerge instance from @fastify/deepmerge.
22
+ *
23
+ * This provides direct access to the deepmerge function for advanced use cases,
24
+ * allowing merging of multiple objects and custom options.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { deepmerge } from '@pixpilot/object';
29
+ * const result = deepmerge({ a: 1 }, { b: 2 }, { c: 3 });
30
+ * // { a: 1, b: 2, c: 3 }
31
+ * ```
32
+ */
33
+ declare function deepMerge<T extends Record<string, unknown>, U extends Record<string, unknown>>(target: T, source: U): T & U;
34
+ //#endregion
35
+ export { deepMerge, deepMergeMany };
@@ -0,0 +1,35 @@
1
+ //#region src/deep-merge.d.ts
2
+ /**
3
+ * Deep merge multiple objects.
4
+ *
5
+ * Uses @fastify/deepmerge to merge any number of objects into a single result.
6
+ * Objects are merged from left to right, with later objects overriding earlier ones.
7
+ *
8
+ * @param objects - The objects to merge
9
+ * @returns A new merged object
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const obj1 = { a: 1, b: { c: 2 } };
14
+ * const obj2 = { b: { d: 3 }, e: 4 };
15
+ * const obj3 = { e: 5, f: 6 };
16
+ * deepMergeMany(obj1, obj2, obj3); // { a: 1, b: { c: 2, d: 3 }, e: 5, f: 6 }
17
+ * ```
18
+ */
19
+ declare function deepMergeMany<T extends Record<string, unknown>>(...objects: T[]): Record<string, unknown>;
20
+ /**
21
+ * Re-export the configured deepmerge instance from @fastify/deepmerge.
22
+ *
23
+ * This provides direct access to the deepmerge function for advanced use cases,
24
+ * allowing merging of multiple objects and custom options.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { deepmerge } from '@pixpilot/object';
29
+ * const result = deepmerge({ a: 1 }, { b: 2 }, { c: 3 });
30
+ * // { a: 1, b: 2, c: 3 }
31
+ * ```
32
+ */
33
+ declare function deepMerge<T extends Record<string, unknown>, U extends Record<string, unknown>>(target: T, source: U): T & U;
34
+ //#endregion
35
+ export { deepMerge, deepMergeMany };
@@ -0,0 +1 @@
1
+ import e from"@fastify/deepmerge";let t=null;function n(){return t||=e(),t}function r(...e){if(e.length===0)return{};if(e.length===1)return e[0]??{};let t={};for(let r of e)t=n()(t,r);return t}function i(e,t){return n()(e,t)}export{i as deepMerge,r as deepMergeMany};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=/([\p{Ll}\d])(\p{Lu})/gu,t=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,r=/(\d)\p{Ll}|(\p{L})\d/u,n=/[^\p{L}\d]+/giu,o="$1\0$2";function c(r){let c=r.trim();c=c.replace(e,o).replace(t,o),c=c.replace(n,"\0");let s=0,u=c.length;for(;"\0"===c.charAt(s);)s++;if(s===u)return[];for(;"\0"===c.charAt(u-1);)u--;return c.slice(s,u).split(/\0/g)}function s(e){const t=c(e);for(let e=0;e<t.length;e++){const n=t[e],o=r.exec(n);if(o){const r=o.index+(o[1]??o[2]).length;t.splice(e,1,n.slice(0,r),n.slice(r))}}return t}function u(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function f(e,t={}){const r=t.split??(t.separateNumbers?s:c),n=t.prefixCharacters??"",o=t.suffixCharacters??"";let u=0,f=e.length;for(;u<e.length;){const t=e.charAt(u);if(!n.includes(t))break;u++}for(;f>u;){const t=f-1,r=e.charAt(t);if(!o.includes(r))break;f=t}return[e.slice(0,u),r(e.slice(u,f)),e.slice(f)]}function i(e){return function(e,t){const[r,n,o]=f(e,t),c=u(t?.locale),s=function(e){return t=>t.toLocaleUpperCase(e)}(t?.locale),i=function(e,t){return(r,n)=>{const o=r[0];return(n>0&&o>="0"&&o<="9"?"_"+o:t(o))+e(r.slice(1))}}(c,s);return r+n.map((e,t)=>0===t?c(e):i(e,t)).join("")+o}(e)}function l(e){return function(e,t){const[r,n,o]=f(e,t);return r+n.map(u(t?.locale)).join(t?.delimiter??" ")+o}(e,{delimiter:"_"})}function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,y={exports:{}};var g=(a||(a=1,function(e){const t=Object.getPrototypeOf({});function r(){return function(e){return!("object"!=typeof e||null===e||e instanceof RegExp||e instanceof Date)}}function n(e){function n(e){return"constructor"!==e&&"prototype"!==e&&"__proto__"!==e}const o=Object.prototype.propertyIsEnumerable,c=e?.symbols?function(e){const t=Object.keys(e),r=Object.getOwnPropertySymbols(e);for(let n=0,c=r.length;n<c;++n)o.call(e,r[n])&&t.push(r[n]);return t}:Object.keys,s="function"==typeof e?.cloneProtoObject?e.cloneProtoObject:void 0,u="function"==typeof e?.isMergeableObject?e.isMergeableObject:r(),f=e&&"function"==typeof e.mergeArray?e.mergeArray({clone:i,deepmerge:l,getKeys:c,isMergeableObject:u}):function(e,t){const r=e.length,n=t.length;let o=0;const c=new Array(r+n);for(;o<r;++o)c[o]=i(e[o]);for(o=0;o<n;++o)c[o+r]=i(t[o]);return c};function i(e){return u(e)?Array.isArray(e)?function(e){let t=0;const r=e.length,n=new Array(r);for(;t<r;++t)n[t]=i(e[t]);return n}(e):function(e){const r={};if(s&&Object.getPrototypeOf(e)!==t)return s(e);const o=c(e);let u,f,l;for(u=0,f=o.length;u<f;++u)n(l=o[u])&&(r[l]=i(e[l]));return r}(e):e}function l(e,r){const o=Array.isArray(r),p=Array.isArray(e);return"object"!=typeof(a=r)||null===a?r:u(e)?o&&p?f(e,r):o!==p?i(r):function(e,r){const o={},f=c(e),p=c(r);let a,y,g;for(a=0,y=f.length;a<y;++a)n(g=f[a])&&-1===p.indexOf(g)&&(o[g]=i(e[g]));for(a=0,y=p.length;a<y;++a)n(g=p[a])&&(g in e?-1!==f.indexOf(g)&&(s&&u(r[g])&&Object.getPrototypeOf(r[g])!==t?o[g]=s(r[g]):o[g]=l(e[g],r[g])):o[g]=i(r[g]));return o}(e,r):i(r);var a}return e?.all?function(){switch(arguments.length){case 0:return{};case 1:return i(arguments[0]);case 2:return l(arguments[0],arguments[1])}let e;for(let t=0,r=arguments.length;t<r;++t)e=l(e,arguments[t]);return e}:l}e.exports=n,e.exports.default=n,e.exports.deepmerge=n,Object.defineProperty(e.exports,"isMergeableObject",{get:r})}(y)),y.exports);function b(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const j=p(g)();exports.deepClone=function e(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(t=>e(t));const r={};for(const[n,o]of Object.entries(t))r[n]=e(o);return r},exports.deepEqual=function e(t,r){if(t===r)return!0;if(typeof t!=typeof r)return!1;if(null===t||null===r)return!1;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(Array.isArray(t)&&Array.isArray(r))return t.length===r.length&&t.every((t,n)=>e(t,r[n]));if("object"==typeof t&&"object"==typeof r){const n=Object.keys(t),o=Object.keys(r);return n.length===o.length&&n.every(n=>e(t[n],r[n]))}return!1},exports.deepmerge=j,exports.flatKeys=function e(t,r=""){const n=[];for(const[o,c]of Object.entries(t)){const t=r?`${r}.${o}`:o;b(c)?n.push(...e(c,t)):n.push(t)}return n},exports.get=function(e,t,r){const n=t.split(".");let o=e;for(const e of n){if(null==o||"object"!=typeof o||!(e in o))return r;o=o[e]}return o},exports.has=function(e,t){const r=t.split(".");let n=e;for(const e of r){if(null==n||"object"!=typeof n||!(e in n))return!1;n=n[e]}return!0},exports.isEmptyObject=function(e){return b(e)&&0===Object.keys(e).length},exports.isObject=b,exports.isPlainObject=function(e){if(!b(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},exports.keysToCamelCase=function e(t){if(Array.isArray(t))return t.map(e);if(null===t||"object"!=typeof t)return t;const r={};for(const[n,o]of Object.entries(t)){r[i(n)]=e(o)}return r},exports.keysToSnakeCase=function e(t){if(Array.isArray(t))return t.map(e);if(null===t||"object"!=typeof t)return t;const r={};for(const[n,o]of Object.entries(t)){r[l(n)]=e(o)}return r},exports.mapKeys=function(e,t){const r={};for(const[n,o]of Object.entries(e)){r[t(n)]=o}return r},exports.mapValues=function(e,t){const r={};for(const[n,o]of Object.entries(e))r[n]=t(o,n);return r},exports.merge=function(e,t){return j(e,t)},exports.mergeAll=function(...e){if(0===e.length)return{};if(1===e.length)return e[0]??{};let t={};for(const r of e)t=j(t,r);return t},exports.omit=function(e,t){const r={...e};for(const e of t)delete r[e];return r},exports.pick=function(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r},exports.set=function(e,t,r){const n=t.split("."),o=n.pop();if(null==o||0===o.length)return e;let c=e;for(const e of n)e in c&&b(c[e])||(c[e]={}),c=c[e];return c[o]=r,e};
1
+ const e=require(`./deep-merge.cjs`),t=require(`./keys-to-camel-case.cjs`),n=require(`./keys-to-snake-case.cjs`),r=require(`./type-guards.cjs`),i=require(`./manipulation.cjs`);exports.deepClone=i.deepClone,exports.deepEqual=i.deepEqual,exports.deepMerge=e.deepMerge,exports.deepMergeMany=e.deepMergeMany,exports.flatKeys=i.flatKeys,exports.get=i.get,exports.has=i.has,exports.isEmptyObject=r.isEmptyObject,exports.isObject=r.isObject,exports.isPlainObject=r.isPlainObject,exports.keysToCamelCase=t.keysToCamelCase,exports.keysToSnakeCase=n.keysToSnakeCase,exports.mapKeys=i.mapKeys,exports.mapValues=i.mapValues,exports.omit=i.omit,exports.pick=i.pick,exports.set=i.set;
@@ -0,0 +1,6 @@
1
+ import { deepMerge, deepMergeMany } from "./deep-merge.cjs";
2
+ import { KeysToCamelCase, ToCamelCase, keysToCamelCase } from "./keys-to-camel-case.cjs";
3
+ import { KeysToSnakeCase, ToSnakeCase, keysToSnakeCase } from "./keys-to-snake-case.cjs";
4
+ import { deepClone, deepEqual, flatKeys, get, has, mapKeys, mapValues, omit, pick, set } from "./manipulation.cjs";
5
+ import { isEmptyObject, isObject, isPlainObject } from "./type-guards.cjs";
6
+ export { KeysToCamelCase, KeysToSnakeCase, ToCamelCase, ToSnakeCase, deepClone, deepEqual, deepMerge, deepMergeMany, flatKeys, get, has, isEmptyObject, isObject, isPlainObject, keysToCamelCase, keysToSnakeCase, mapKeys, mapValues, omit, pick, set };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export * from './keys-to-camel-case';
2
- export * from './keys-to-snake-case';
3
- export * from './manipulation';
4
- export * from './type-guards';
1
+ import { deepMerge, deepMergeMany } from "./deep-merge.js";
2
+ import { KeysToCamelCase, ToCamelCase, keysToCamelCase } from "./keys-to-camel-case.js";
3
+ import { KeysToSnakeCase, ToSnakeCase, keysToSnakeCase } from "./keys-to-snake-case.js";
4
+ import { deepClone, deepEqual, flatKeys, get, has, mapKeys, mapValues, omit, pick, set } from "./manipulation.js";
5
+ import { isEmptyObject, isObject, isPlainObject } from "./type-guards.js";
6
+ export { KeysToCamelCase, KeysToSnakeCase, ToCamelCase, ToSnakeCase, deepClone, deepEqual, deepMerge, deepMergeMany, flatKeys, get, has, isEmptyObject, isObject, isPlainObject, keysToCamelCase, keysToSnakeCase, mapKeys, mapValues, omit, pick, set };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- const t=/([\p{Ll}\d])(\p{Lu})/gu,e=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,n=/(\d)\p{Ll}|(\p{L})\d/u,r=/[^\p{L}\d]+/giu,o="$1\0$2";function c(n){let c=n.trim();c=c.replace(t,o).replace(e,o),c=c.replace(r,"\0");let u=0,f=c.length;for(;"\0"===c.charAt(u);)u++;if(u===f)return[];for(;"\0"===c.charAt(f-1);)f--;return c.slice(u,f).split(/\0/g)}function u(t){const e=c(t);for(let t=0;t<e.length;t++){const r=e[t],o=n.exec(r);if(o){const n=o.index+(o[1]??o[2]).length;e.splice(t,1,r.slice(0,n),r.slice(n))}}return e}function f(t){return!1===t?t=>t.toLowerCase():e=>e.toLocaleLowerCase(t)}function i(t,e={}){const n=e.split??(e.separateNumbers?u:c),r=e.prefixCharacters??"",o=e.suffixCharacters??"";let f=0,i=t.length;for(;f<t.length;){const e=t.charAt(f);if(!r.includes(e))break;f++}for(;i>f;){const e=i-1,n=t.charAt(e);if(!o.includes(n))break;i=e}return[t.slice(0,f),n(t.slice(f,i)),t.slice(i)]}function s(t){return function(t,e){const[n,r,o]=i(t,e),c=f(e?.locale),u=function(t){return e=>e.toLocaleUpperCase(t)}(e?.locale),s=function(t,e){return(n,r)=>{const o=n[0];return(r>0&&o>="0"&&o<="9"?"_"+o:e(o))+t(n.slice(1))}}(c,u);return n+r.map((t,e)=>0===e?c(t):s(t,e)).join("")+o}(t)}function l(t){return function(t,e){const[n,r,o]=i(t,e);return n+r.map(f(e?.locale)).join(e?.delimiter??" ")+o}(t,{delimiter:"_"})}function a(t){if(Array.isArray(t))return t.map(a);if(null===t||"object"!=typeof t)return t;const e={};for(const[n,r]of Object.entries(t)){e[s(n)]=a(r)}return e}function p(t){if(Array.isArray(t))return t.map(p);if(null===t||"object"!=typeof t)return t;const e={};for(const[n,r]of Object.entries(t)){e[l(n)]=p(r)}return e}function y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g,b={exports:{}};var j=(g||(g=1,function(t){const e=Object.getPrototypeOf({});function n(){return function(t){return!("object"!=typeof t||null===t||t instanceof RegExp||t instanceof Date)}}function r(t){function r(t){return"constructor"!==t&&"prototype"!==t&&"__proto__"!==t}const o=Object.prototype.propertyIsEnumerable,c=t?.symbols?function(t){const e=Object.keys(t),n=Object.getOwnPropertySymbols(t);for(let r=0,c=n.length;r<c;++r)o.call(t,n[r])&&e.push(n[r]);return e}:Object.keys,u="function"==typeof t?.cloneProtoObject?t.cloneProtoObject:void 0,f="function"==typeof t?.isMergeableObject?t.isMergeableObject:n(),i=t&&"function"==typeof t.mergeArray?t.mergeArray({clone:s,deepmerge:l,getKeys:c,isMergeableObject:f}):function(t,e){const n=t.length,r=e.length;let o=0;const c=new Array(n+r);for(;o<n;++o)c[o]=s(t[o]);for(o=0;o<r;++o)c[o+n]=s(e[o]);return c};function s(t){return f(t)?Array.isArray(t)?function(t){let e=0;const n=t.length,r=new Array(n);for(;e<n;++e)r[e]=s(t[e]);return r}(t):function(t){const n={};if(u&&Object.getPrototypeOf(t)!==e)return u(t);const o=c(t);let f,i,l;for(f=0,i=o.length;f<i;++f)r(l=o[f])&&(n[l]=s(t[l]));return n}(t):t}function l(t,n){const o=Array.isArray(n),a=Array.isArray(t);return"object"!=typeof(p=n)||null===p?n:f(t)?o&&a?i(t,n):o!==a?s(n):function(t,n){const o={},i=c(t),a=c(n);let p,y,g;for(p=0,y=i.length;p<y;++p)r(g=i[p])&&-1===a.indexOf(g)&&(o[g]=s(t[g]));for(p=0,y=a.length;p<y;++p)r(g=a[p])&&(g in t?-1!==i.indexOf(g)&&(u&&f(n[g])&&Object.getPrototypeOf(n[g])!==e?o[g]=u(n[g]):o[g]=l(t[g],n[g])):o[g]=s(n[g]));return o}(t,n):s(n);var p}return t?.all?function(){switch(arguments.length){case 0:return{};case 1:return s(arguments[0]);case 2:return l(arguments[0],arguments[1])}let t;for(let e=0,n=arguments.length;e<n;++e)t=l(t,arguments[e]);return t}:l}t.exports=r,t.exports.default=r,t.exports.deepmerge=r,Object.defineProperty(t.exports,"isMergeableObject",{get:n})}(b)),b.exports);function O(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function h(t){if(!O(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function A(t){return O(t)&&0===Object.keys(t).length}const d=y(j)();function m(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}function x(t,e){const n={...t};for(const t of e)delete n[t];return n}function L(t,e){return d(t,e)}function w(...t){if(0===t.length)return{};if(1===t.length)return t[0]??{};let e={};for(const n of t)e=d(e,n);return e}function P(t,e,n){const r=e.split(".");let o=t;for(const t of r){if(null==o||"object"!=typeof o||!(t in o))return n;o=o[t]}return o}function _(t,e,n){const r=e.split("."),o=r.pop();if(null==o||0===o.length)return t;let c=t;for(const t of r)t in c&&O(c[t])||(c[t]={}),c=c[t];return c[o]=n,t}function k(t,e){const n=e.split(".");let r=t;for(const t of n){if(null==r||"object"!=typeof r||!(t in r))return!1;r=r[t]}return!0}function v(t,e=""){const n=[];for(const[r,o]of Object.entries(t)){const t=e?`${e}.${r}`:r;O(o)?n.push(...v(o,t)):n.push(t)}return n}function C(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(t=>C(t));const e={};for(const[n,r]of Object.entries(t))e[n]=C(r);return e}function D(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null===t||null===e)return!1;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((t,n)=>D(t,e[n]));if("object"==typeof t&&"object"==typeof e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>D(t[n],e[n]))}return!1}function M(t,e){const n={};for(const[r,o]of Object.entries(t))n[r]=e(o,r);return n}function E(t,e){const n={};for(const[r,o]of Object.entries(t)){n[e(r)]=o}return n}export{C as deepClone,D as deepEqual,d as deepmerge,v as flatKeys,P as get,k as has,A as isEmptyObject,O as isObject,h as isPlainObject,a as keysToCamelCase,p as keysToSnakeCase,E as mapKeys,M as mapValues,L as merge,w as mergeAll,x as omit,m as pick,_ as set};
1
+ import{deepMerge as e,deepMergeMany as t}from"./deep-merge.js";import{keysToCamelCase as n}from"./keys-to-camel-case.js";import{keysToSnakeCase as r}from"./keys-to-snake-case.js";import{isEmptyObject as i,isObject as a,isPlainObject as o}from"./type-guards.js";import{deepClone as s,deepEqual as c,flatKeys as l,get as u,has as d,mapKeys as f,mapValues as p,omit as m,pick as h,set as g}from"./manipulation.js";export{s as deepClone,c as deepEqual,e as deepMerge,t as deepMergeMany,l as flatKeys,u as get,d as has,i as isEmptyObject,a as isObject,o as isPlainObject,n as keysToCamelCase,r as keysToSnakeCase,f as mapKeys,p as mapValues,m as omit,h as pick,g as set};
@@ -0,0 +1 @@
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@pixpilot/string`);t=e.__toESM(t);function n(e){if(Array.isArray(e))return e.map(n);if(typeof e!=`object`||!e)return e;let r={};for(let[i,a]of Object.entries(e)){let e=(0,t.toCamelCase)(i);r[e]=n(a)}return r}exports.keysToCamelCase=n;
@@ -0,0 +1,6 @@
1
+ //#region src/keys-to-camel-case.d.ts
2
+ type ToCamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` ? `${P1}${Uppercase<P2>}${ToCamelCase<P3>}` : S;
3
+ type KeysToCamelCase<T> = { [K in keyof T as ToCamelCase<string & K>]: T[K] extends Record<string, unknown> ? KeysToCamelCase<T[K]> : T[K] extends readonly (infer U)[] ? U extends Record<string, unknown> ? readonly KeysToCamelCase<U>[] : T[K] : T[K] };
4
+ declare function keysToCamelCase<T>(obj: T): T extends Record<string, unknown> ? KeysToCamelCase<T> : T;
5
+ //#endregion
6
+ export { KeysToCamelCase, ToCamelCase, keysToCamelCase };
@@ -1,5 +1,6 @@
1
- export type ToCamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` ? `${P1}${Uppercase<P2>}${ToCamelCase<P3>}` : S;
2
- export type KeysToCamelCase<T> = {
3
- [K in keyof T as ToCamelCase<string & K>]: T[K] extends Record<string, unknown> ? KeysToCamelCase<T[K]> : T[K] extends readonly (infer U)[] ? U extends Record<string, unknown> ? readonly KeysToCamelCase<U>[] : T[K] : T[K];
4
- };
5
- export declare function keysToCamelCase<T>(obj: T): T extends Record<string, unknown> ? KeysToCamelCase<T> : T;
1
+ //#region src/keys-to-camel-case.d.ts
2
+ type ToCamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` ? `${P1}${Uppercase<P2>}${ToCamelCase<P3>}` : S;
3
+ type KeysToCamelCase<T> = { [K in keyof T as ToCamelCase<string & K>]: T[K] extends Record<string, unknown> ? KeysToCamelCase<T[K]> : T[K] extends readonly (infer U)[] ? U extends Record<string, unknown> ? readonly KeysToCamelCase<U>[] : T[K] : T[K] };
4
+ declare function keysToCamelCase<T>(obj: T): T extends Record<string, unknown> ? KeysToCamelCase<T> : T;
5
+ //#endregion
6
+ export { KeysToCamelCase, ToCamelCase, keysToCamelCase };
@@ -0,0 +1 @@
1
+ import{toCamelCase as e}from"@pixpilot/string";function t(n){if(Array.isArray(n))return n.map(t);if(typeof n!=`object`||!n)return n;let r={};for(let[i,a]of Object.entries(n)){let n=e(i);r[n]=t(a)}return r}export{t as keysToCamelCase};
@@ -0,0 +1 @@
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@pixpilot/string`);t=e.__toESM(t);function n(e){if(Array.isArray(e))return e.map(n);if(typeof e!=`object`||!e)return e;let r={};for(let[i,a]of Object.entries(e)){let e=(0,t.toSnakeCase)(i);r[e]=n(a)}return r}exports.keysToSnakeCase=n;
@@ -0,0 +1,9 @@
1
+ //#region src/keys-to-snake-case.d.ts
2
+ type ToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Uppercase<T> ? '_' : ''}${Lowercase<T>}${ToSnakeCase<U>}` : S;
3
+ type KeysToSnakeCase<T$1> = { [K in keyof T$1 as ToSnakeCase<string & K>]: T$1[K] extends Record<string, unknown> ? KeysToSnakeCase<T$1[K]> : T$1[K] extends readonly (infer U)[] ? U extends Record<string, unknown> ? readonly KeysToSnakeCase<U>[] : T$1[K] : T$1[K] };
4
+ /**
5
+ * Converts object keys from camelCase to snake_case recursively
6
+ */
7
+ declare function keysToSnakeCase<T$1>(obj: T$1): T$1 extends Record<string, unknown> ? KeysToSnakeCase<T$1> : T$1;
8
+ //#endregion
9
+ export { KeysToSnakeCase, ToSnakeCase, keysToSnakeCase };
@@ -1,8 +1,9 @@
1
- export type ToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Uppercase<T> ? '_' : ''}${Lowercase<T>}${ToSnakeCase<U>}` : S;
2
- export type KeysToSnakeCase<T> = {
3
- [K in keyof T as ToSnakeCase<string & K>]: T[K] extends Record<string, unknown> ? KeysToSnakeCase<T[K]> : T[K] extends readonly (infer U)[] ? U extends Record<string, unknown> ? readonly KeysToSnakeCase<U>[] : T[K] : T[K];
4
- };
1
+ //#region src/keys-to-snake-case.d.ts
2
+ type ToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Uppercase<T> ? '_' : ''}${Lowercase<T>}${ToSnakeCase<U>}` : S;
3
+ type KeysToSnakeCase<T$1> = { [K in keyof T$1 as ToSnakeCase<string & K>]: T$1[K] extends Record<string, unknown> ? KeysToSnakeCase<T$1[K]> : T$1[K] extends readonly (infer U)[] ? U extends Record<string, unknown> ? readonly KeysToSnakeCase<U>[] : T$1[K] : T$1[K] };
5
4
  /**
6
5
  * Converts object keys from camelCase to snake_case recursively
7
6
  */
8
- export declare function keysToSnakeCase<T>(obj: T): T extends Record<string, unknown> ? KeysToSnakeCase<T> : T;
7
+ declare function keysToSnakeCase<T$1>(obj: T$1): T$1 extends Record<string, unknown> ? KeysToSnakeCase<T$1> : T$1;
8
+ //#endregion
9
+ export { KeysToSnakeCase, ToSnakeCase, keysToSnakeCase };
@@ -0,0 +1 @@
1
+ import{toSnakeCase as e}from"@pixpilot/string";function t(n){if(Array.isArray(n))return n.map(t);if(typeof n!=`object`||!n)return n;let r={};for(let[i,a]of Object.entries(n)){let n=e(i);r[n]=t(a)}return r}export{t as keysToSnakeCase};
@@ -0,0 +1 @@
1
+ const e=require(`./type-guards.cjs`);function t(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function n(e,t){let n={...e};for(let e of t)delete n[e];return n}function r(e,t,n){let r=t.split(`.`),i=e;for(let e of r)if(typeof i==`object`&&i&&e in i)i=i[e];else return n;return i}function i(t,n,r){let i=n.split(`.`),a=i.pop();if(a==null||a.length===0)return t;let o=t;for(let t of i)(!(t in o)||!e.isObject(o[t]))&&(o[t]={}),o=o[t];return o[a]=r,t}function a(e,t){let n=t.split(`.`),r=e;for(let e of n)if(typeof r==`object`&&r&&e in r)r=r[e];else return!1;return!0}function o(t,n=``){let r=[];for(let[i,a]of Object.entries(t)){let t=n?`${n}.${i}`:i;e.isObject(a)?r.push(...o(a,t)):r.push(t)}return r}function s(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e))return e.map(e=>s(e));let t={};for(let[n,r]of Object.entries(e))t[n]=s(r);return t}function c(e,t){if(e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length?e.every((e,n)=>c(e,t[n])):!1;if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>c(e[n],t[n])):!1}return!1}function l(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r);return n}function u(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t(r);n[e]=i}return n}exports.deepClone=s,exports.deepEqual=c,exports.flatKeys=o,exports.get=r,exports.has=a,exports.mapKeys=u,exports.mapValues=l,exports.omit=n,exports.pick=t,exports.set=i;
@@ -0,0 +1,148 @@
1
+ //#region src/manipulation.d.ts
2
+ /**
3
+ * Pick specific keys from an object.
4
+ *
5
+ * @param obj - The source object
6
+ * @param keys - The keys to pick
7
+ * @returns A new object with only the specified keys
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const obj = { a: 1, b: 2, c: 3 };
12
+ * pick(obj, ['a', 'c']); // { a: 1, c: 3 }
13
+ * ```
14
+ */
15
+ declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;
16
+ /**
17
+ * Omit specific keys from an object.
18
+ *
19
+ * @param obj - The source object
20
+ * @param keys - The keys to omit
21
+ * @returns A new object without the specified keys
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const obj = { a: 1, b: 2, c: 3 };
26
+ * omit(obj, ['b']); // { a: 1, c: 3 }
27
+ * ```
28
+ */
29
+ declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Omit<T, K>;
30
+ /**
31
+ * Get a nested value from an object using a path string.
32
+ *
33
+ * @param obj - The source object
34
+ * @param path - The path to the value (e.g., 'a.b.c')
35
+ * @param defaultValue - The default value to return if the path doesn't exist
36
+ * @returns The value at the path or the default value
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const obj = { a: { b: { c: 42 } } };
41
+ * get(obj, 'a.b.c'); // 42
42
+ * get(obj, 'a.b.x', 'default'); // 'default'
43
+ * ```
44
+ */
45
+ declare function get<T = unknown>(obj: Record<string, unknown>, path: string, defaultValue?: T): T | undefined;
46
+ /**
47
+ * Set a nested value in an object using a path string.
48
+ *
49
+ * @param obj - The target object
50
+ * @param path - The path to set the value at (e.g., 'a.b.c')
51
+ * @param value - The value to set
52
+ * @returns The modified object
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const obj = { a: { b: {} } };
57
+ * set(obj, 'a.b.c', 42); // { a: { b: { c: 42 } } }
58
+ * ```
59
+ */
60
+ declare function set<T extends Record<string, unknown>>(obj: T, path: string, value: unknown): T;
61
+ /**
62
+ * Check if an object has a nested property using a path string.
63
+ *
64
+ * @param obj - The source object
65
+ * @param path - The path to check (e.g., 'a.b.c')
66
+ * @returns True if the path exists, false otherwise
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const obj = { a: { b: { c: 42 } } };
71
+ * has(obj, 'a.b.c'); // true
72
+ * has(obj, 'a.b.x'); // false
73
+ * ```
74
+ */
75
+ declare function has(obj: Record<string, unknown>, path: string): boolean;
76
+ /**
77
+ * Get all keys of an object including nested keys.
78
+ *
79
+ * @param obj - The source object
80
+ * @param prefix - The prefix to prepend to keys (used internally for recursion)
81
+ * @returns An array of all keys including nested paths
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const obj = { a: 1, b: { c: 2, d: { e: 3 } } };
86
+ * flatKeys(obj); // ['a', 'b.c', 'b.d.e']
87
+ * ```
88
+ */
89
+ declare function flatKeys(obj: Record<string, unknown>, prefix?: string): string[];
90
+ /**
91
+ * Deep clone an object.
92
+ *
93
+ * @param obj - The object to clone
94
+ * @returns A deep clone of the object
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const obj = { a: 1, b: { c: 2 } };
99
+ * const cloned = deepClone(obj);
100
+ * cloned.b.c = 3;
101
+ * console.log(obj.b.c); // 2 (original unchanged)
102
+ * ```
103
+ */
104
+ declare function deepClone<T>(obj: T): T;
105
+ /**
106
+ * Compare two objects for deep equality.
107
+ *
108
+ * @param obj1 - The first object
109
+ * @param obj2 - The second object
110
+ * @returns True if the objects are deeply equal, false otherwise
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * deepEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); // true
115
+ * deepEqual({ a: 1 }, { a: 2 }); // false
116
+ * ```
117
+ */
118
+ declare function deepEqual(obj1: unknown, obj2: unknown): boolean;
119
+ /**
120
+ * Map over the values of an object.
121
+ *
122
+ * @param obj - The source object
123
+ * @param fn - The mapping function
124
+ * @returns A new object with mapped values
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const obj = { a: 1, b: 2, c: 3 };
129
+ * mapValues(obj, (value) => value * 2); // { a: 2, b: 4, c: 6 }
130
+ * ```
131
+ */
132
+ declare function mapValues<T extends Record<string, unknown>, U>(obj: T, fn: (value: T[keyof T], key: keyof T) => U): Record<keyof T, U>;
133
+ /**
134
+ * Map over the keys of an object.
135
+ *
136
+ * @param obj - The source object
137
+ * @param fn - The mapping function
138
+ * @returns A new object with mapped keys
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * const obj = { a: 1, b: 2 };
143
+ * mapKeys(obj, (key) => key.toUpperCase()); // { A: 1, B: 2 }
144
+ * ```
145
+ */
146
+ declare function mapKeys<T extends Record<string, unknown>>(obj: T, fn: (key: keyof T) => string): Record<string, T[keyof T]>;
147
+ //#endregion
148
+ export { deepClone, deepEqual, flatKeys, get, has, mapKeys, mapValues, omit, pick, set };
@@ -1,4 +1,4 @@
1
- declare const deepMerge: import("@fastify/deepmerge").DeepMergeFn;
1
+ //#region src/manipulation.d.ts
2
2
  /**
3
3
  * Pick specific keys from an object.
4
4
  *
@@ -12,7 +12,7 @@ declare const deepMerge: import("@fastify/deepmerge").DeepMergeFn;
12
12
  * pick(obj, ['a', 'c']); // { a: 1, c: 3 }
13
13
  * ```
14
14
  */
15
- export declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;
15
+ declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;
16
16
  /**
17
17
  * Omit specific keys from an object.
18
18
  *
@@ -26,56 +26,7 @@ export declare function pick<T extends Record<string, unknown>, K extends keyof
26
26
  * omit(obj, ['b']); // { a: 1, c: 3 }
27
27
  * ```
28
28
  */
29
- export declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Omit<T, K>;
30
- /**
31
- * Deep merge two objects.
32
- *
33
- * Uses @fastify/deepmerge for efficient and reliable deep merging.
34
- *
35
- * @param target - The target object
36
- * @param source - The source object to merge into the target
37
- * @returns A new merged object
38
- *
39
- * @example
40
- * ```typescript
41
- * const obj1 = { a: 1, b: { c: 2 } };
42
- * const obj2 = { b: { d: 3 }, e: 4 };
43
- * merge(obj1, obj2); // { a: 1, b: { c: 2, d: 3 }, e: 4 }
44
- * ```
45
- */
46
- export declare function merge<T extends Record<string, unknown>, U extends Record<string, unknown>>(target: T, source: U): T & U;
47
- /**
48
- * Deep merge multiple objects.
49
- *
50
- * Uses @fastify/deepmerge to merge any number of objects into a single result.
51
- * Objects are merged from left to right, with later objects overriding earlier ones.
52
- *
53
- * @param objects - The objects to merge
54
- * @returns A new merged object
55
- *
56
- * @example
57
- * ```typescript
58
- * const obj1 = { a: 1, b: { c: 2 } };
59
- * const obj2 = { b: { d: 3 }, e: 4 };
60
- * const obj3 = { e: 5, f: 6 };
61
- * mergeAll(obj1, obj2, obj3); // { a: 1, b: { c: 2, d: 3 }, e: 5, f: 6 }
62
- * ```
63
- */
64
- export declare function mergeAll<T extends Record<string, unknown>>(...objects: T[]): Record<string, unknown>;
65
- /**
66
- * Re-export the configured deepmerge instance from @fastify/deepmerge.
67
- *
68
- * This provides direct access to the deepmerge function for advanced use cases,
69
- * allowing merging of multiple objects and custom options.
70
- *
71
- * @example
72
- * ```typescript
73
- * import { deepmerge } from '@pixpilot/object';
74
- * const result = deepmerge({ a: 1 }, { b: 2 }, { c: 3 });
75
- * // { a: 1, b: 2, c: 3 }
76
- * ```
77
- */
78
- export { deepMerge as deepmerge };
29
+ declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]): Omit<T, K>;
79
30
  /**
80
31
  * Get a nested value from an object using a path string.
81
32
  *
@@ -91,7 +42,7 @@ export { deepMerge as deepmerge };
91
42
  * get(obj, 'a.b.x', 'default'); // 'default'
92
43
  * ```
93
44
  */
94
- export declare function get<T = unknown>(obj: Record<string, unknown>, path: string, defaultValue?: T): T | undefined;
45
+ declare function get<T = unknown>(obj: Record<string, unknown>, path: string, defaultValue?: T): T | undefined;
95
46
  /**
96
47
  * Set a nested value in an object using a path string.
97
48
  *
@@ -106,7 +57,7 @@ export declare function get<T = unknown>(obj: Record<string, unknown>, path: str
106
57
  * set(obj, 'a.b.c', 42); // { a: { b: { c: 42 } } }
107
58
  * ```
108
59
  */
109
- export declare function set<T extends Record<string, unknown>>(obj: T, path: string, value: unknown): T;
60
+ declare function set<T extends Record<string, unknown>>(obj: T, path: string, value: unknown): T;
110
61
  /**
111
62
  * Check if an object has a nested property using a path string.
112
63
  *
@@ -121,7 +72,7 @@ export declare function set<T extends Record<string, unknown>>(obj: T, path: str
121
72
  * has(obj, 'a.b.x'); // false
122
73
  * ```
123
74
  */
124
- export declare function has(obj: Record<string, unknown>, path: string): boolean;
75
+ declare function has(obj: Record<string, unknown>, path: string): boolean;
125
76
  /**
126
77
  * Get all keys of an object including nested keys.
127
78
  *
@@ -135,7 +86,7 @@ export declare function has(obj: Record<string, unknown>, path: string): boolean
135
86
  * flatKeys(obj); // ['a', 'b.c', 'b.d.e']
136
87
  * ```
137
88
  */
138
- export declare function flatKeys(obj: Record<string, unknown>, prefix?: string): string[];
89
+ declare function flatKeys(obj: Record<string, unknown>, prefix?: string): string[];
139
90
  /**
140
91
  * Deep clone an object.
141
92
  *
@@ -150,7 +101,7 @@ export declare function flatKeys(obj: Record<string, unknown>, prefix?: string):
150
101
  * console.log(obj.b.c); // 2 (original unchanged)
151
102
  * ```
152
103
  */
153
- export declare function deepClone<T>(obj: T): T;
104
+ declare function deepClone<T>(obj: T): T;
154
105
  /**
155
106
  * Compare two objects for deep equality.
156
107
  *
@@ -164,7 +115,7 @@ export declare function deepClone<T>(obj: T): T;
164
115
  * deepEqual({ a: 1 }, { a: 2 }); // false
165
116
  * ```
166
117
  */
167
- export declare function deepEqual(obj1: unknown, obj2: unknown): boolean;
118
+ declare function deepEqual(obj1: unknown, obj2: unknown): boolean;
168
119
  /**
169
120
  * Map over the values of an object.
170
121
  *
@@ -178,7 +129,7 @@ export declare function deepEqual(obj1: unknown, obj2: unknown): boolean;
178
129
  * mapValues(obj, (value) => value * 2); // { a: 2, b: 4, c: 6 }
179
130
  * ```
180
131
  */
181
- export declare function mapValues<T extends Record<string, unknown>, U>(obj: T, fn: (value: T[keyof T], key: keyof T) => U): Record<keyof T, U>;
132
+ declare function mapValues<T extends Record<string, unknown>, U>(obj: T, fn: (value: T[keyof T], key: keyof T) => U): Record<keyof T, U>;
182
133
  /**
183
134
  * Map over the keys of an object.
184
135
  *
@@ -192,4 +143,6 @@ export declare function mapValues<T extends Record<string, unknown>, U>(obj: T,
192
143
  * mapKeys(obj, (key) => key.toUpperCase()); // { A: 1, B: 2 }
193
144
  * ```
194
145
  */
195
- export declare function mapKeys<T extends Record<string, unknown>>(obj: T, fn: (key: keyof T) => string): Record<string, T[keyof T]>;
146
+ declare function mapKeys<T extends Record<string, unknown>>(obj: T, fn: (key: keyof T) => string): Record<string, T[keyof T]>;
147
+ //#endregion
148
+ export { deepClone, deepEqual, flatKeys, get, has, mapKeys, mapValues, omit, pick, set };
@@ -0,0 +1 @@
1
+ import{isObject as e}from"./type-guards.js";function t(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function n(e,t){let n={...e};for(let e of t)delete n[e];return n}function r(e,t,n){let r=t.split(`.`),i=e;for(let e of r)if(typeof i==`object`&&i&&e in i)i=i[e];else return n;return i}function i(t,n,r){let i=n.split(`.`),a=i.pop();if(a==null||a.length===0)return t;let o=t;for(let t of i)(!(t in o)||!e(o[t]))&&(o[t]={}),o=o[t];return o[a]=r,t}function a(e,t){let n=t.split(`.`),r=e;for(let e of n)if(typeof r==`object`&&r&&e in r)r=r[e];else return!1;return!0}function o(t,n=``){let r=[];for(let[i,a]of Object.entries(t)){let t=n?`${n}.${i}`:i;e(a)?r.push(...o(a,t)):r.push(t)}return r}function s(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e))return e.map(e=>s(e));let t={};for(let[n,r]of Object.entries(e))t[n]=s(r);return t}function c(e,t){if(e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length?e.every((e,n)=>c(e,t[n])):!1;if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>c(e[n],t[n])):!1}return!1}function l(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r);return n}function u(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t(r);n[e]=i}return n}export{s as deepClone,c as deepEqual,o as flatKeys,r as get,a as has,u as mapKeys,l as mapValues,n as omit,t as pick,i as set};
@@ -0,0 +1 @@
1
+ function e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function t(t){if(!e(t))return!1;let n=Object.getPrototypeOf(t);return n===null||n===Object.prototype}function n(t){return e(t)&&Object.keys(t).length===0}exports.isEmptyObject=n,exports.isObject=e,exports.isPlainObject=t;
@@ -0,0 +1,49 @@
1
+ //#region src/type-guards.d.ts
2
+ /**
3
+ * Type guard to check if a value is an object (and not null or an array).
4
+ *
5
+ * @param value - The value to check
6
+ * @returns True if the value is an object, false otherwise
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * isObject({}); // true
11
+ * isObject({ key: 'value' }); // true
12
+ * isObject([]); // false
13
+ * isObject(null); // false
14
+ * isObject('string'); // false
15
+ * ```
16
+ */
17
+ declare function isObject(value: unknown): value is Record<string, unknown>;
18
+ /**
19
+ * Type guard to check if a value is a plain object
20
+ * (created with {} or new Object(), not a class instance).
21
+ *
22
+ * @param value - The value to check
23
+ * @returns True if the value is a plain object, false otherwise
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * isPlainObject({}); // true
28
+ * isPlainObject({ key: 'value' }); // true
29
+ * isPlainObject(new Date()); // false
30
+ * isPlainObject([]); // false
31
+ * ```
32
+ */
33
+ declare function isPlainObject(value: unknown): value is Record<string, unknown>;
34
+ /**
35
+ * Type guard to check if a value is an empty object.
36
+ *
37
+ * @param value - The value to check
38
+ * @returns True if the value is an empty object, false otherwise
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * isEmptyObject({}); // true
43
+ * isEmptyObject({ key: 'value' }); // false
44
+ * isEmptyObject([]); // false
45
+ * ```
46
+ */
47
+ declare function isEmptyObject(value: unknown): boolean;
48
+ //#endregion
49
+ export { isEmptyObject, isObject, isPlainObject };
@@ -1,3 +1,4 @@
1
+ //#region src/type-guards.d.ts
1
2
  /**
2
3
  * Type guard to check if a value is an object (and not null or an array).
3
4
  *
@@ -13,7 +14,7 @@
13
14
  * isObject('string'); // false
14
15
  * ```
15
16
  */
16
- export declare function isObject(value: unknown): value is Record<string, unknown>;
17
+ declare function isObject(value: unknown): value is Record<string, unknown>;
17
18
  /**
18
19
  * Type guard to check if a value is a plain object
19
20
  * (created with {} or new Object(), not a class instance).
@@ -29,7 +30,7 @@ export declare function isObject(value: unknown): value is Record<string, unknow
29
30
  * isPlainObject([]); // false
30
31
  * ```
31
32
  */
32
- export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
33
+ declare function isPlainObject(value: unknown): value is Record<string, unknown>;
33
34
  /**
34
35
  * Type guard to check if a value is an empty object.
35
36
  *
@@ -43,4 +44,6 @@ export declare function isPlainObject(value: unknown): value is Record<string, u
43
44
  * isEmptyObject([]); // false
44
45
  * ```
45
46
  */
46
- export declare function isEmptyObject(value: unknown): boolean;
47
+ declare function isEmptyObject(value: unknown): boolean;
48
+ //#endregion
49
+ export { isEmptyObject, isObject, isPlainObject };
@@ -0,0 +1 @@
1
+ function e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function t(t){if(!e(t))return!1;let n=Object.getPrototypeOf(t);return n===null||n===Object.prototype}function n(t){return e(t)&&Object.keys(t).length===0}export{n as isEmptyObject,e as isObject,t as isPlainObject};
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@pixpilot/object",
3
3
  "type": "module",
4
- "version": "1.1.5",
4
+ "version": "1.1.10",
5
+ "description": "A collection of utility functions for object manipulation and transformation.",
5
6
  "author": "Pixpilot <m.doaie@hotmail.com>",
6
7
  "license": "MIT",
7
8
  "repository": {
@@ -25,27 +26,26 @@
25
26
  },
26
27
  "dependencies": {
27
28
  "@fastify/deepmerge": "^3.1.0",
28
- "@pixpilot/string": "2.0.5"
29
+ "@pixpilot/string": "2.3.0"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@manypkg/get-packages": "^3.1.0",
32
- "@rollup/plugin-alias": "^5.1.1",
33
- "@rollup/plugin-node-resolve": "^16.0.3",
34
33
  "@types/node": "^22.18.10",
35
34
  "eslint": "^9.37.0",
36
- "rollup": "^4.52.4",
35
+ "tsdown": "^0.15.8",
37
36
  "typescript": "^5.9.3",
38
37
  "@internal/eslint-config": "0.3.0",
39
38
  "@internal/prettier-config": "0.0.1",
40
- "@internal/rollup-config": "0.1.0",
41
39
  "@internal/tsconfig": "0.1.0",
42
- "@internal/vitest-config": "0.1.0"
40
+ "@internal/vitest-config": "0.1.0",
41
+ "@internal/tsdown-config": "0.1.0"
43
42
  },
44
43
  "prettier": "@internal/prettier-config",
45
44
  "scripts": {
46
45
  "clean": "git clean -xdf .cache .turbo dist",
47
46
  "clean:all": "git clean -xdf .cache .turbo dist node_modules",
48
- "build": "pnpm run clean && rollup -c",
47
+ "build": "tsdown",
48
+ "buld:watch": "tsdown --watch",
49
49
  "test": "vitest --run --passWithNoTests",
50
50
  "test:watch": "vitest --watch",
51
51
  "test:ui": "vitest --ui",