@pistachiojs/core 0.3.0 → 0.4.0-dev.0

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.
package/dist/index.d.ts CHANGED
@@ -224,6 +224,22 @@ declare function freeze<T extends object>(value: T): Readonly<T>;
224
224
  */
225
225
  declare function merge<T extends object, U extends object>(valueA: T, valueB: U): T & U;
226
226
 
227
+ /**
228
+ * Creates a new object with all keys except specified ones from source object.
229
+ * @param value - Object value to omit from.
230
+ * @param keys - Array of keys to omit.
231
+ * @returns New object without omitted keys.
232
+ */
233
+ declare function omit<T extends object, K extends keyof T>(value: T, keys: K[]): Omit<T, K>;
234
+
235
+ /**
236
+ * Creates a new object with only specified keys from source object.
237
+ * @param value - Object value to pick from.
238
+ * @param keys - Array of keys to pick.
239
+ * @returns New object with only picked keys.
240
+ */
241
+ declare function pick<T extends object, K extends keyof T>(value: T, keys: K[]): Pick<T, K>;
242
+
227
243
  /**
228
244
  * Extracts a section of a string between two indices.
229
245
  * @param value - String value to slice.
@@ -321,4 +337,4 @@ declare function toUpperCase(value: string): string;
321
337
  */
322
338
  declare function truncate(value: string, length: number, suffix?: string): string;
323
339
 
324
- export { add, ceil, clamp, difference, divide, filter, floor, forEach, freeze, isArray, isBigInt, isBoolean, isDate, isDefined, isEmpty, isFreeze, isFunction, isNumber, isObject, isString, isSymbol, isTruthy, isUndefined, join, map, merge, multiply, round, slice, sort, split, subtract, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
340
+ export { add, ceil, clamp, difference, divide, filter, floor, forEach, freeze, isArray, isBigInt, isBoolean, isDate, isDefined, isEmpty, isFreeze, isFunction, isNumber, isObject, isString, isSymbol, isTruthy, isUndefined, join, map, merge, multiply, omit, pick, round, slice, sort, split, subtract, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- function l(e,n,t,f){const{symmetric:i=!1}=f??{};if(e.length===0&&n.length===0)return[];if(e.length===0)return i?[...n]:[];if(n.length===0)return[...e];if(!t){const o=new Set(n),r=e.filter(u=>!o.has(u));if(i){const u=new Set(e),a=n.filter(s=>!u.has(s));return[...r,...a]}return r}const c=e.filter(o=>!n.some(r=>t(o,r)));if(i){const o=n.filter(r=>!e.some(u=>t(r,u)));return[...c,...o]}return c}function p(e,n){return e.filter(n)}function g(e,n){e.forEach(n)}function h(e,n){return e.join(n)}function y(e,n){return e.map(n)}function C(e,n){return[...e].sort(n)}function m(e){return Array.isArray(e)}function b(e){return typeof e=="bigint"}function d(e){return typeof e=="boolean"}function w(e){return e instanceof Date}function A(e){return e!=null}function j(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function U(e){return typeof e=="object"&&e!==null&&Object.isFrozen(e)}function z(e){return typeof e=="function"}function L(e){return typeof e=="number"&&!Number.isNaN(e)}function S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _(e){return typeof e=="string"}function M(e){return typeof e=="symbol"}function $(e){return!!e}function N(e){return e===void 0}function O(e,n){return e+n}function D(e){return Math.ceil(e)}function E(e,n,t){return Math.min(Math.max(e,n),t)}function F(e,n){return e/n}function Z(e){return Math.floor(e)}function k(e,n){return e*n}function v(e){return Math.round(e)}function x(e,n){return e-n}function B(e){return Object.freeze(e)}function T(e,n){return{...e,...n}}function I(e,n,t){return e.slice(n,t)}function K(e,n,t){return e.split(n,t)}function P(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(n,t)=>t?t.toUpperCase():"").replace(/^[A-Z]/,n=>n.toLowerCase())}function q(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function G(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function H(e){return e.toLowerCase()}function J(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(n,t)=>t?t.toUpperCase():"").replace(/^[a-z]/,n=>n.toUpperCase())}function Q(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function R(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function V(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function W(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,n=>n.toUpperCase())}function X(e){return e.toUpperCase()}function Y(e,n,t="..."){return e.length<=n?e:n-t.length<=0?t.slice(0,n):e.slice(0,n-t.length)+t}export{O as add,D as ceil,E as clamp,l as difference,F as divide,p as filter,Z as floor,g as forEach,B as freeze,m as isArray,b as isBigInt,d as isBoolean,w as isDate,A as isDefined,j as isEmpty,U as isFreeze,z as isFunction,L as isNumber,S as isObject,_ as isString,M as isSymbol,$ as isTruthy,N as isUndefined,h as join,y as map,T as merge,k as multiply,v as round,I as slice,C as sort,K as split,x as subtract,P as toCamelCase,q as toCapitalize,G as toKebabCase,H as toLowerCase,J as toPascalCase,Q as toSentenceCase,R as toSlug,V as toSnakeCase,W as toTitleCase,X as toUpperCase,Y as truncate};
1
+ function l(e,t,n,r){const{symmetric:u=!1}=r??{};if(e.length===0&&t.length===0)return[];if(e.length===0)return u?[...t]:[];if(t.length===0)return[...e];if(!n){const i=new Set(t),o=e.filter(c=>!i.has(c));if(u){const c=new Set(e),f=t.filter(s=>!c.has(s));return[...o,...f]}return o}const a=e.filter(i=>!t.some(o=>n(i,o)));if(u){const i=t.filter(o=>!e.some(c=>n(o,c)));return[...a,...i]}return a}function p(e,t){return e.filter(t)}function g(e,t){e.forEach(t)}function h(e,t){return e.join(t)}function C(e,t){return e.map(t)}function y(e,t){return[...e].sort(t)}function m(e){return Array.isArray(e)}function b(e){return typeof e=="bigint"}function A(e){return typeof e=="boolean"}function $(e){return e instanceof Date}function d(e){return e!=null}function w(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function z(e){return typeof e=="object"&&e!==null&&Object.isFrozen(e)}function L(e){return typeof e=="function"}function j(e){return typeof e=="number"&&!Number.isNaN(e)}function U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e){return typeof e=="string"}function Z(e){return typeof e=="symbol"}function _(e){return!!e}function M(e){return e===void 0}function N(e,t){return e+t}function O(e){return Math.ceil(e)}function k(e,t,n){return Math.min(Math.max(e,t),n)}function D(e,t){return e/t}function E(e){return Math.floor(e)}function F(e,t){return e*t}function v(e){return Math.round(e)}function x(e,t){return e-t}function B(e){return Object.freeze(e)}function T(e,t){return{...e,...t}}function I(e,t){const n={...e},r=new Set(t);for(const u of r)delete n[u];return n}function K(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function P(e,t,n){return e.slice(t,n)}function q(e,t,n){return e.split(t,n)}function G(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"")}function H(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function J(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Q(e){return e.toLowerCase()}function R(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function V(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function W(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([a-zA-Z])(\d)/g,"$1-$2").replace(/(\d)([a-zA-Z])/g,"$1-$2").toLowerCase().replace(/[^\w\s-]/g," ").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function X(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function Y(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function ee(e){return e.toUpperCase()}function te(e,t,n="..."){return e.length<=t?e:t-n.length<=0?n.slice(0,t):e.slice(0,t-n.length)+n}export{N as add,O as ceil,k as clamp,l as difference,D as divide,p as filter,E as floor,g as forEach,B as freeze,m as isArray,b as isBigInt,A as isBoolean,$ as isDate,d as isDefined,w as isEmpty,z as isFreeze,L as isFunction,j as isNumber,U as isObject,S as isString,Z as isSymbol,_ as isTruthy,M as isUndefined,h as join,C as map,T as merge,F as multiply,I as omit,K as pick,v as round,P as slice,y as sort,q as split,x as subtract,G as toCamelCase,H as toCapitalize,J as toKebabCase,Q as toLowerCase,R as toPascalCase,V as toSentenceCase,W as toSlug,X as toSnakeCase,Y as toTitleCase,ee as toUpperCase,te as truncate};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";function l(e,t,n,a){const{symmetric:u=!1}=a??{};if(e.length===0&&t.length===0)return[];if(e.length===0)return u?[...t]:[];if(t.length===0)return[...e];if(!n){const o=new Set(t),r=e.filter(i=>!o.has(i));if(u){const i=new Set(e),c=t.filter(f=>!i.has(f));return[...r,...c]}return r}const s=e.filter(o=>!t.some(r=>n(o,r)));if(u){const o=t.filter(r=>!e.some(i=>n(r,i)));return[...s,...o]}return s}function p(e,t){return e.filter(t)}function g(e,t){e.forEach(t)}function C(e,t){return e.join(t)}function h(e,t){return e.map(t)}function y(e,t){return[...e].sort(t)}function m(e){return Array.isArray(e)}function b(e){return typeof e=="bigint"}function d(e){return typeof e=="boolean"}function w(e){return e instanceof Date}function A(e){return e!=null}function S(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function j(e){return typeof e=="object"&&e!==null&&Object.isFrozen(e)}function z(e){return typeof e=="function"}function U(e){return typeof e=="number"&&!Number.isNaN(e)}function L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _(e){return typeof e=="string"}function D(e){return typeof e=="symbol"}function E(e){return!!e}function F(e){return e===void 0}function M(e,t){return e+t}function N(e){return Math.ceil(e)}function O(e,t,n){return Math.min(Math.max(e,t),n)}function $(e,t){return e/t}function B(e){return Math.floor(e)}function T(e,t){return e*t}function k(e){return Math.round(e)}function v(e,t){return e-t}function Z(e){return Object.freeze(e)}function I(e,t){return{...e,...t}}function K(e,t,n){return e.slice(t,n)}function P(e,t,n){return e.split(t,n)}function x(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function q(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function G(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function H(e){return e.toLowerCase()}function J(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function Q(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function R(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function V(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function W(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function X(e){return e.toUpperCase()}function Y(e,t,n="..."){return e.length<=t?e:t-n.length<=0?n.slice(0,t):e.slice(0,t-n.length)+n}exports.add=M,exports.ceil=N,exports.clamp=O,exports.difference=l,exports.divide=$,exports.filter=p,exports.floor=B,exports.forEach=g,exports.freeze=Z,exports.isArray=m,exports.isBigInt=b,exports.isBoolean=d,exports.isDate=w,exports.isDefined=A,exports.isEmpty=S,exports.isFreeze=j,exports.isFunction=z,exports.isNumber=U,exports.isObject=L,exports.isString=_,exports.isSymbol=D,exports.isTruthy=E,exports.isUndefined=F,exports.join=C,exports.map=h,exports.merge=I,exports.multiply=T,exports.round=k,exports.slice=K,exports.sort=y,exports.split=P,exports.subtract=v,exports.toCamelCase=x,exports.toCapitalize=q,exports.toKebabCase=G,exports.toLowerCase=H,exports.toPascalCase=J,exports.toSentenceCase=Q,exports.toSlug=R,exports.toSnakeCase=V,exports.toTitleCase=W,exports.toUpperCase=X,exports.truncate=Y;
1
+ "use strict";function l(e,t,n,r){const{symmetric:i=!1}=r??{};if(e.length===0&&t.length===0)return[];if(e.length===0)return i?[...t]:[];if(t.length===0)return[...e];if(!n){const u=new Set(t),o=e.filter(a=>!u.has(a));if(i){const a=new Set(e),s=t.filter(f=>!a.has(f));return[...o,...s]}return o}const c=e.filter(u=>!t.some(o=>n(u,o)));if(i){const u=t.filter(o=>!e.some(a=>n(o,a)));return[...c,...u]}return c}function p(e,t){return e.filter(t)}function g(e,t){e.forEach(t)}function C(e,t){return e.join(t)}function h(e,t){return e.map(t)}function y(e,t){return[...e].sort(t)}function m(e){return Array.isArray(e)}function d(e){return typeof e=="bigint"}function b(e){return typeof e=="boolean"}function A(e){return e instanceof Date}function z(e){return e!=null}function $(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function w(e){return typeof e=="object"&&e!==null&&Object.isFrozen(e)}function S(e){return typeof e=="function"}function j(e){return typeof e=="number"&&!Number.isNaN(e)}function L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function U(e){return typeof e=="string"}function Z(e){return typeof e=="symbol"}function _(e){return!!e}function k(e){return e===void 0}function D(e,t){return e+t}function E(e){return Math.ceil(e)}function F(e,t,n){return Math.min(Math.max(e,t),n)}function M(e,t){return e/t}function N(e){return Math.floor(e)}function O(e,t){return e*t}function B(e){return Math.round(e)}function T(e,t){return e-t}function v(e){return Object.freeze(e)}function I(e,t){return{...e,...t}}function K(e,t){const n={...e},r=new Set(t);for(const i of r)delete n[i];return n}function P(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function x(e,t,n){return e.slice(t,n)}function q(e,t,n){return e.split(t,n)}function G(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"")}function H(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function J(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Q(e){return e.toLowerCase()}function R(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function V(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function W(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([a-zA-Z])(\d)/g,"$1-$2").replace(/(\d)([a-zA-Z])/g,"$1-$2").toLowerCase().replace(/[^\w\s-]/g," ").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function X(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function Y(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function ee(e){return e.toUpperCase()}function te(e,t,n="..."){return e.length<=t?e:t-n.length<=0?n.slice(0,t):e.slice(0,t-n.length)+n}exports.add=D,exports.ceil=E,exports.clamp=F,exports.difference=l,exports.divide=M,exports.filter=p,exports.floor=N,exports.forEach=g,exports.freeze=v,exports.isArray=m,exports.isBigInt=d,exports.isBoolean=b,exports.isDate=A,exports.isDefined=z,exports.isEmpty=$,exports.isFreeze=w,exports.isFunction=S,exports.isNumber=j,exports.isObject=L,exports.isString=U,exports.isSymbol=Z,exports.isTruthy=_,exports.isUndefined=k,exports.join=C,exports.map=h,exports.merge=I,exports.multiply=O,exports.omit=K,exports.pick=P,exports.round=B,exports.slice=x,exports.sort=y,exports.split=q,exports.subtract=T,exports.toCamelCase=G,exports.toCapitalize=H,exports.toKebabCase=J,exports.toLowerCase=Q,exports.toPascalCase=R,exports.toSentenceCase=V,exports.toSlug=W,exports.toSnakeCase=X,exports.toTitleCase=Y,exports.toUpperCase=ee,exports.truncate=te;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pistachiojs/core",
3
3
  "description": "Framework-agnostic pure utility functions for common programming tasks",
4
- "version": "0.3.0",
4
+ "version": "0.4.0-dev.0",
5
5
  "author": "Dirga Prakesha <dirga.prakesha@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {