@pistachiojs/core 0.2.0-dev.0 → 0.2.0-dev.1

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
@@ -49,6 +49,70 @@ declare function map<T, U>(value: readonly T[], callbackFn: (item: T, index: num
49
49
  */
50
50
  declare function sort<T>(value: readonly T[], compareFn?: (valueA: T, valueB: T) => number): T[];
51
51
 
52
+ /**
53
+ * Checks if a value is an array.
54
+ * @param value - Value to check.
55
+ * @returns True if value is an array, false otherwise.
56
+ */
57
+ declare function isArray(value: unknown): value is unknown[];
58
+
59
+ /**
60
+ * Checks if a value is a bigint.
61
+ * @param value - Value to check.
62
+ * @returns True if value is a bigint, false otherwise.
63
+ */
64
+ declare function isBigInt(value: unknown): value is bigint;
65
+
66
+ /**
67
+ * Checks if a value is a boolean.
68
+ * @param value - Value to check.
69
+ * @returns True if value is a boolean, false otherwise.
70
+ */
71
+ declare function isBoolean(value: unknown): value is boolean;
72
+
73
+ /**
74
+ * Checks if a value is a date object.
75
+ * @param value - Value to check.
76
+ * @returns True if value is a date object, false otherwise.
77
+ */
78
+ declare function isDate(value: unknown): value is Date;
79
+
80
+ /**
81
+ * Checks if a value is defined (not null or undefined).
82
+ * @param value - Value to check.
83
+ * @returns True if value is defined, false otherwise.
84
+ */
85
+ declare function isDefined<T>(value: T | null | undefined): value is T;
86
+
87
+ /**
88
+ * Checks if a value is empty (null, undefined, empty string, empty array or empty object).
89
+ * @param value - Value to check.
90
+ * @returns True if value is empty, false otherwise.
91
+ */
92
+ declare function isEmpty(value: unknown): boolean;
93
+
94
+ /**
95
+ * Checks if a value is a function.
96
+ * @param value - Value to check.
97
+ * @returns True if value is a function, false otherwise.
98
+ */
99
+ declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
100
+
101
+ /**
102
+ * Freezes an object making it immutable.
103
+ * @param value - Object value to freeze.
104
+ * @returns Object value frozened.
105
+ */
106
+ declare function freeze<T extends object>(value: T): Readonly<T>;
107
+
108
+ /**
109
+ * Merges two objects into a new object.
110
+ * @param valueA - Object value to merge.
111
+ * @param valueB - Object value to merge.
112
+ * @returns New object value with properties from both objects.
113
+ */
114
+ declare function merge<T extends object, U extends object>(valueA: T, valueB: U): T & U;
115
+
52
116
  /**
53
117
  * Extracts a section of a string between two indices.
54
118
  * @param value - String value to slice.
@@ -146,4 +210,4 @@ declare function toUpperCase(value: string): string;
146
210
  */
147
211
  declare function truncate(value: string, length: number, suffix?: string): string;
148
212
 
149
- export { difference, filter, forEach, join, map, slice, sort, split, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
213
+ export { difference, filter, forEach, freeze, isArray, isBigInt, isBoolean, isDate, isDefined, isEmpty, isFunction, join, map, merge, slice, sort, split, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
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};
1
+ 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),s=t.filter(f=>!i.has(f));return[...r,...s]}return r}const c=e.filter(o=>!t.some(r=>n(o,r)));if(u){const o=t.filter(r=>!e.some(i=>n(r,i)));return[...c,...o]}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 w(e){return Array.isArray(e)}function A(e){return typeof e=="bigint"}function m(e){return typeof e=="boolean"}function L(e){return e instanceof Date}function U(e){return e!=null}function b(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function _(e){return typeof e=="function"}function z(e){return Object.freeze(e)}function j(e,t){return{...e,...t}}function S(e,t,n){return e.slice(t,n)}function $(e,t,n){return e.split(t,n)}function d(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function D(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function E(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 k(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function B(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function O(e){return e.length===0?e:e.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 F(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function I(e){return e.toUpperCase()}function K(e,t,n="..."){return e.length<=t?e:t-n.length<=0?n.slice(0,t):e.slice(0,t-n.length)+n}export{l as difference,p as filter,g as forEach,z as freeze,w as isArray,A as isBigInt,m as isBoolean,L as isDate,U as isDefined,b as isEmpty,_ as isFunction,C as join,h as map,j as merge,S as slice,y as sort,$ as split,d as toCamelCase,D as toCapitalize,E as toKebabCase,Z as toLowerCase,k as toPascalCase,B as toSentenceCase,O as toSlug,x as toSnakeCase,F as toTitleCase,I as toUpperCase,K as truncate};
package/dist/index.js CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";function f(e,t,n,c){const{symmetric:a=!1}=c??{};if(e.length===0&&t.length===0)return[];if(e.length===0)return a?[...t]:[];if(t.length===0)return[...e];if(!n){const o=new Set(t),r=e.filter(i=>!o.has(i));if(a){const i=new Set(e),u=t.filter(l=>!i.has(l));return[...r,...u]}return r}const s=e.filter(o=>!t.some(r=>n(o,r)));if(a){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 w(e){return typeof e=="bigint"}function A(e){return typeof e=="boolean"}function b(e){return e instanceof Date}function L(e){return e!=null}function U(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=="function"}function S(e){return Object.freeze(e)}function _(e,t){return{...e,...t}}function j(e,t,n){return e.slice(t,n)}function d(e,t,n){return e.split(t,n)}function D(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function E(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 B(e){return e.toLowerCase()}function k(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function Z(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function F(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function I(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function K(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function O(e){return e.toUpperCase()}function P(e,t,n="..."){return e.length<=t?e:t-n.length<=0?n.slice(0,t):e.slice(0,t-n.length)+n}exports.difference=f,exports.filter=p,exports.forEach=g,exports.freeze=S,exports.isArray=m,exports.isBigInt=w,exports.isBoolean=A,exports.isDate=b,exports.isDefined=L,exports.isEmpty=U,exports.isFunction=z,exports.join=C,exports.map=h,exports.merge=_,exports.slice=j,exports.sort=y,exports.split=d,exports.toCamelCase=D,exports.toCapitalize=E,exports.toKebabCase=$,exports.toLowerCase=B,exports.toPascalCase=k,exports.toSentenceCase=Z,exports.toSlug=F,exports.toSnakeCase=I,exports.toTitleCase=K,exports.toUpperCase=O,exports.truncate=P;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pistachiojs/core",
3
3
  "description": "-",
4
- "version": "0.2.0-dev.0",
4
+ "version": "0.2.0-dev.1",
5
5
  "author": "Dirga Prakesha <dirga.prakesha@gmail.com>",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,