@clerc/utils 1.1.1 → 1.2.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.mts +6 -3
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -24,8 +24,10 @@ type CamelCase<S extends string> = S extends `${infer Head} ${infer Tail}` ? `${
|
|
|
24
24
|
declare const looseIsArray: <T>(arr: any) => arr is readonly T[];
|
|
25
25
|
declare const toArray: <T>(a: MaybeArray<T>) => T[];
|
|
26
26
|
/**
|
|
27
|
-
* Converts a dash- or space-separated string to camelCase.
|
|
28
|
-
*
|
|
27
|
+
* Converts a dash- or space-separated string to camelCase.
|
|
28
|
+
*
|
|
29
|
+
* Not using regexp for better performance, because this function is used in
|
|
30
|
+
* parser.
|
|
29
31
|
*/
|
|
30
32
|
declare function camelCase(str: string): string;
|
|
31
33
|
declare function joinWithAnd(values: string[]): string;
|
|
@@ -35,5 +37,6 @@ declare const formatVersion: (v: string) => string;
|
|
|
35
37
|
declare const isTruthy: <T>(item: T) => item is Exclude<T, false | null | undefined>;
|
|
36
38
|
declare const objectIsEmpty: (obj: Record<string, any>) => boolean;
|
|
37
39
|
declare const resolveValue: <T>(value: MaybeGetter<T>) => T;
|
|
40
|
+
declare const hasOwn: (obj: object, key: PropertyKey) => boolean;
|
|
38
41
|
//#endregion
|
|
39
|
-
export { CamelCase, DeepPrettify, IsAny, LiteralUnion, MaybeArray, MaybeGetter, PartialRequired, Prettify, RequireExactlyOne, RequireExactlyOneOrNone, ToArray, UnionToIntersection, camelCase, formatFlagName, formatVersion, isTruthy, joinWithAnd, kebabCase, looseIsArray, objectIsEmpty, resolveValue, toArray };
|
|
42
|
+
export { CamelCase, DeepPrettify, IsAny, LiteralUnion, MaybeArray, MaybeGetter, PartialRequired, Prettify, RequireExactlyOne, RequireExactlyOneOrNone, ToArray, UnionToIntersection, camelCase, formatFlagName, formatVersion, hasOwn, isTruthy, joinWithAnd, kebabCase, looseIsArray, objectIsEmpty, resolveValue, toArray };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>Array.isArray(e),t=e=>Array.isArray(e)?e:[e];function
|
|
1
|
+
const e=e=>Array.isArray(e),t=e=>Array.isArray(e)?e:[e],n=new Map;function r(e){let t=n.get(e);if(t!==void 0)return t;let r=e.length,i=-1;for(let t=0;t<r;t++){let n=e.charCodeAt(t);if(n===45||n===32){i=t;break}}if(i===-1)return n.set(e,e),e;let a=e.slice(0,i);for(let t=i;t<r;t++){let n=e.charCodeAt(t);if((n===45||n===32)&&t+1<r){let n=e.charCodeAt(t+1);n>=97&&n<=122?(a+=String.fromCharCode(n-32),t++):(a+=e[t+1],t++)}else n!==45&&n!==32&&(a+=e[t])}return n.set(e,a),a}function i(e){if(e.length===0)return``;if(e.length===1)return e[0];let t=e.pop();return`${e.join(`, `)} and ${t}`}const a=e=>e.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`),o=e=>e.length<=1?`-${e}`:`--${a(e)}`,s=e=>e.length===0?``:e.startsWith(`v`)?e:`v${e}`,c=Boolean,l=e=>Object.keys(e).length===0,u=e=>typeof e==`function`?e():e,d=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);export{r as camelCase,o as formatFlagName,s as formatVersion,d as hasOwn,c as isTruthy,i as joinWithAnd,a as kebabCase,e as looseIsArray,l as objectIsEmpty,u as resolveValue,t as toArray};
|