@clerc/utils
Advanced tools
Comparing version 0.39.0 to 0.40.0
import * as _clerc_core from '@clerc/core'; | ||
import { Command, I18N, Commands, CommandType, TranslateFn, RootType, Root } from '@clerc/core'; | ||
import { I18N, Commands, CommandType, TranslateFn, Command, RootType, Root } from '@clerc/core'; | ||
@@ -20,3 +20,2 @@ type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false; | ||
declare const arrayStartsWith: <T>(arr: T[], start: T[]) => boolean; | ||
declare const generateCommandsFromCommandArray: <C extends Command>(commands: C[]) => Dict<C>; | ||
declare const semanticArray: (arr: string[], { add, t }: I18N) => string; | ||
@@ -27,2 +26,2 @@ declare function resolveCommandStrict(commands: Commands, name: CommandType | string[], t: TranslateFn): [Command<string | RootType> | undefined, string[] | RootType | undefined]; | ||
export { CamelCase, Dict, Equals, KebabCase, MaybeArray, ToArray, arrayEquals, arrayStartsWith, camelCase, generateCommandsFromCommandArray, gracefulFlagName, gracefulVersion, kebabCase, resolveCommandStrict, resolveRootCommands, resolveSubcommandsByParent, semanticArray, toArray }; | ||
export { CamelCase, Dict, Equals, KebabCase, MaybeArray, ToArray, arrayEquals, arrayStartsWith, camelCase, gracefulFlagName, gracefulVersion, kebabCase, resolveCommandStrict, resolveRootCommands, resolveSubcommandsByParent, semanticArray, toArray }; |
@@ -1,1 +0,1 @@ | ||
import{Root as s,resolveFlattenCommands as d}from"@clerc/core";const y={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},m=e=>Array.isArray(e)?e:[e],A=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),u=e=>e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`),C=e=>e.length<=1?`-${e}`:`--${u(e)}`,p=e=>e.length===0?"":e.startsWith("v")?e:`v${e}`,i=(e,t)=>t.length!==e.length?!1:e.every((n,r)=>n===t[r]),f=(e,t)=>t.length>e.length?!1:i(e.slice(0,t.length),t),v=e=>{const t={};for(const n of e)t[n.name]=n;return t},b=(e,{add:t,t:n})=>(t(y),e.length<=1?e[0]:n("utils.and",e.slice(0,-1).join(", "),e[e.length-1]));function N(e,t,n){if(t===s)return[e[s],s];const r=m(t),a=d(e,n);let o,l;return a.forEach((h,c)=>{c===s||l===s||i(r,c)&&(o=h,l=c)}),[o,l]}function g(e,t,n=1/0){const r=t===""?[]:Array.isArray(t)?t:t.split(" ");return Object.values(e).filter(a=>{const o=a.name.split(" ");return f(o,r)&&o.length-r.length<=n})}const $=e=>g(e,"",1);export{i as arrayEquals,f as arrayStartsWith,A as camelCase,v as generateCommandsFromCommandArray,C as gracefulFlagName,p as gracefulVersion,u as kebabCase,N as resolveCommandStrict,$ as resolveRootCommands,g as resolveSubcommandsByParent,b as semanticArray,m as toArray}; | ||
import{Root as o,resolveFlattenCommands as y}from"@clerc/core";const d={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},u=e=>Array.isArray(e)?e:[e],A=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),m=e=>e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`),C=e=>e.length<=1?`-${e}`:`--${m(e)}`,p=e=>e.length===0?"":e.startsWith("v")?e:`v${e}`,i=(e,t)=>t.length!==e.length?!1:e.every((n,r)=>n===t[r]),f=(e,t)=>t.length>e.length?!1:i(e.slice(0,t.length),t),v=(e,{add:t,t:n})=>(t(d),e.length<=1?e[0]:n("utils.and",e.slice(0,-1).join(", "),e[e.length-1]));function b(e,t,n){if(t===o)return[e[o],o];const r=u(t),l=y(e,n);let s,a;return l.forEach((h,c)=>{c===o||a===o||i(r,c)&&(s=h,a=c)}),[s,a]}function g(e,t,n=1/0){const r=t===""?[]:Array.isArray(t)?t:t.split(" ");return Object.values(e).filter(l=>{const s=l.name.split(" ");return f(s,r)&&s.length-r.length<=n})}const N=e=>g(e,"",1);export{i as arrayEquals,f as arrayStartsWith,A as camelCase,C as gracefulFlagName,p as gracefulVersion,m as kebabCase,b as resolveCommandStrict,N as resolveRootCommands,g as resolveSubcommandsByParent,v as semanticArray,u as toArray}; |
{ | ||
"name": "@clerc/utils", | ||
"version": "0.39.0", | ||
"version": "0.40.0", | ||
"author": "Ray <i@mk1.io> (https://github.com/so1ve)", | ||
@@ -5,0 +5,0 @@ "description": "Clerc utils", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5717
28