@pistachiojs/core 0.1.0-dev.5 → 0.2.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 +52 -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
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excludes values from other array.
|
|
3
|
+
* @param valueA - Array value to compare.
|
|
4
|
+
* @param valueB - Array value to compare.
|
|
5
|
+
* @param compareFn - Function to determine equality between elements.
|
|
6
|
+
* @param options - Configuration object.
|
|
7
|
+
* @returns Array value containing difference based on specified mode.
|
|
8
|
+
*/
|
|
9
|
+
declare function difference<T>(valueA: readonly T[], valueB: readonly T[], compareFn?: (valueA: T, valueB: T) => boolean, options?: {
|
|
10
|
+
symmetric?: boolean;
|
|
11
|
+
}): T[];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filters an array based on a predicate function.
|
|
15
|
+
* @param value - Array value to filter.
|
|
16
|
+
* @param predicateFn - Function that tests each element.
|
|
17
|
+
* @returns Array value containing only elements that pass test.
|
|
18
|
+
*/
|
|
19
|
+
declare function filter<T>(value: readonly T[], predicateFn: (item: T, index: number, array: readonly T[]) => boolean): T[];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Executes a provided function once for each array element.
|
|
23
|
+
* @param value - Array value to iterate over.
|
|
24
|
+
* @param callbackFn - Function to execute for each element.
|
|
25
|
+
*/
|
|
26
|
+
declare function forEach<T>(value: readonly T[], callbackFn: (item: T, index: number, array: readonly T[]) => void): void;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Joins all elements of an array into a string.
|
|
30
|
+
* @param value - Array value to join.
|
|
31
|
+
* @param separator - String to separate each pair of adjacent elements.
|
|
32
|
+
* @returns String value with all array elements joined.
|
|
33
|
+
*/
|
|
34
|
+
declare function join<T>(value: readonly T[], separator?: string): string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new array populated with results of calling a provided function on every element.
|
|
38
|
+
* @param value - Array value to map over.
|
|
39
|
+
* @param callbackFn - Function that produces an element of new array.
|
|
40
|
+
* @returns New array value with each element being result of callback function.
|
|
41
|
+
*/
|
|
42
|
+
declare function map<T, U>(value: readonly T[], callbackFn: (item: T, index: number, array: readonly T[]) => U): U[];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sorts an array using an compare function.
|
|
46
|
+
* @param value - Array value to sort.
|
|
47
|
+
* @param compareFn - Function that defines sort order.
|
|
48
|
+
* @returns Array value sorted.
|
|
49
|
+
*/
|
|
50
|
+
declare function sort<T>(value: readonly T[], compareFn?: (valueA: T, valueB: T) => number): T[];
|
|
51
|
+
|
|
1
52
|
/**
|
|
2
53
|
* Extracts a section of a string between two indices.
|
|
3
54
|
* @param value - String value to slice.
|
|
@@ -95,4 +146,4 @@ declare function toUpperCase(value: string): string;
|
|
|
95
146
|
*/
|
|
96
147
|
declare function truncate(value: string, length: number, suffix?: string): string;
|
|
97
148
|
|
|
98
|
-
export { slice, split, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
|
|
149
|
+
export { difference, filter, forEach, join, map, slice, sort, split, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(e,r,t,l){const{symmetric:c=!1}=l??{};if(e.length===0&&r.length===0)return[];if(e.length===0)return c?[...r]:[];if(r.length===0)return[...e];if(!t){const o=new Set(r),n=e.filter(a=>!o.has(a));if(c){const a=new Set(e),u=r.filter(i=>!a.has(i));return[...n,...u]}return n}const s=e.filter(o=>!r.some(n=>t(o,n)));if(c){const o=r.filter(n=>!e.some(a=>t(n,a)));return[...s,...o]}return s}function p(e,r){return e.filter(r)}function g(e,r){e.forEach(r)}function C(e,r){return e.join(r)}function h(e,r){return e.map(r)}function w(e,r){return[...e].sort(r)}function L(e,r,t){return e.slice(r,t)}function U(e,r,t){return e.split(r,t)}function m(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(r,t)=>t?t.toUpperCase():"").replace(/^[A-Z]/,r=>r.toLowerCase())}function _(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function A(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function S(e){return e.toLowerCase()}function $(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(r,t)=>t?t.toUpperCase():"").replace(/^[a-z]/,r=>r.toUpperCase())}function z(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Z(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function b(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function d(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,r=>r.toUpperCase())}function j(e){return e.toUpperCase()}function E(e,r,t="..."){return e.length<=r?e:r-t.length<=0?t.slice(0,r):e.slice(0,r-t.length)+t}export{f as difference,p as filter,g as forEach,C as join,h as map,L as slice,w as sort,U as split,m as toCamelCase,_ as toCapitalize,A as toKebabCase,S as toLowerCase,$ as toPascalCase,z as toSentenceCase,Z as toSlug,b as toSnakeCase,d as toTitleCase,j as toUpperCase,E as truncate};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function r(e,t,a){return e.slice(t,
|
|
1
|
+
"use strict";function f(e,t,r,l){const{symmetric:s=!1}=l??{};if(e.length===0&&t.length===0)return[];if(e.length===0)return s?[...t]:[];if(t.length===0)return[...e];if(!r){const o=new Set(t),n=e.filter(a=>!o.has(a));if(s){const a=new Set(e),i=t.filter(u=>!a.has(u));return[...n,...i]}return n}const c=e.filter(o=>!t.some(n=>r(o,n)));if(s){const o=t.filter(n=>!e.some(a=>r(n,a)));return[...c,...o]}return c}function p(e,t){return e.filter(t)}function C(e,t){e.forEach(t)}function g(e,t){return e.join(t)}function h(e,t){return e.map(t)}function w(e,t){return[...e].sort(t)}function m(e,t,r){return e.slice(t,r)}function L(e,t,r){return e.split(t,r)}function U(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function S(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function _(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function z(e){return e.toLowerCase()}function A(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function $(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function b(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function d(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function j(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function E(e){return e.toUpperCase()}function Z(e,t,r="..."){return e.length<=t?e:t-r.length<=0?r.slice(0,t):e.slice(0,t-r.length)+r}exports.difference=f,exports.filter=p,exports.forEach=C,exports.join=g,exports.map=h,exports.slice=m,exports.sort=w,exports.split=L,exports.toCamelCase=U,exports.toCapitalize=S,exports.toKebabCase=_,exports.toLowerCase=z,exports.toPascalCase=A,exports.toSentenceCase=$,exports.toSlug=b,exports.toSnakeCase=d,exports.toTitleCase=j,exports.toUpperCase=E,exports.truncate=Z;
|