@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 +17 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
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,
|
|
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,
|
|
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.
|
|
4
|
+
"version": "0.4.0-dev.0",
|
|
5
5
|
"author": "Dirga Prakesha <dirga.prakesha@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|