Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@waiting/shared-types

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waiting/shared-types - npm Package Compare versions

Comparing version 20.13.0 to 21.0.0

11

dist/lib/template-literal.d.ts

@@ -6,8 +6,9 @@ export type StrSplit<S extends string, D extends string> = string extends S ? string[] : S extends `${infer T}${D}${infer U}` ? [T, ...StrSplit<U, D>] : [

export type TupleJoin<T extends V[], D extends string> = T extends [] ? '' : T extends [unknown] ? `${T[0]}` : T extends [unknown, ...infer U] ? `${T[0]}${D}${TupleJoin<U, D>}` : string;
export type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
export type CamelToSnake<T extends string, D extends string = '_'> = string extends D ? never : T extends `${infer F extends D}${infer R}` ? `${F}${_CamelToSnake<R, D>}` : _CamelToSnake<T, D> extends `${D}${infer U}` ? U : _CamelToSnake<T, D>;
type _CamelToSnake<T extends string, D extends string> = T extends `${infer U}${infer Rest}` ? U extends D ? `${U}${_CamelToSnake<Rest, D>}` : Uppercase<U> extends U ? `${D}${Lowercase<U>}${_CamelToSnake<Rest, D>}` : `${U}${_CamelToSnake<Rest, D>}` : Lowercase<T>;
export type SnakeToCamel<T extends string, D extends string = '_', TrimStart extends boolean = false, TrimEnd extends boolean = false> = string extends D ? never : T extends `${infer F extends D}${infer R}` ? TrimStart extends true ? `${SnakeToCamel<R, D, true, TrimEnd>}` : `${F}${SnakeToCamel<R, D, false, TrimEnd>}` : TrimEnd extends true ? _SnakeToCamelWoTailing<T, D> : _SnakeToCamelWithTailing<T, D>;
type _SnakeToCamelWoTailing<T extends string, D extends string> = T extends `${infer U}${infer R}` ? U extends D ? `${_SnakeToCamelWoTailing<Capitalize<R>, D>}` : `${U}${_SnakeToCamelWoTailing<R, D>}` : T;
type _SnakeToCamelWithTailing<T extends string, D extends string> = T extends `${infer U}${infer R}` ? R extends '' ? U : U extends D ? `${_SnakeToCamelWithTailing<Capitalize<R>, D>}` extends `${infer U1 extends D}${infer R1}` ? `${U}${U1}${_SnakeToCamelWithTailing<Capitalize<R1>, D>}` : `${_SnakeToCamelWithTailing<Capitalize<R>, D>}` : `${U}${_SnakeToCamelWithTailing<R, D>}` : T;
export type SnakeToPascal<T extends string, D extends string = '_', TrimStart extends boolean = false, TrimEnd extends boolean = false> = string extends D ? never : T extends `${infer F extends D}${infer R}` ? TrimStart extends true ? `${Capitalize<SnakeToPascal<R, D, true, TrimEnd>>}` : `${F}${Capitalize<SnakeToPascal<R, D, false, TrimEnd>>}` : TrimEnd extends true ? _SnakeToCamelWoTailing<Capitalize<T>, D> : _SnakeToCamelWithTailing<Capitalize<T>, D>;
type _CamelToSnake<T extends string, D extends string> = T extends `${infer U}${infer Rest}` ? U extends D | Digit ? `${U}${_CamelToSnake<Rest, D>}` : Uppercase<U> extends U ? `${D}${Lowercase<U>}${_CamelToSnake<Rest, D>}` : `${U}${_CamelToSnake<Rest, D>}` : Lowercase<T>;
export type SnakeToCamel<T extends string, D extends string = '_'> = string extends D ? never : T extends `${infer F extends D}${infer R}` ? `${F}${SnakeToCamel<R, D>}` : _SnakeToCamel<T, D>;
type _SnakeToCamel<T extends string, D extends string> = _SnakeToCamelWithTailing<T, D>;
type _SnakeToCamelWithTailing<T extends string, D extends string> = T extends `${infer U}${infer R}` ? R extends '' ? U : U extends D ? `${_SnakeToCamelWithTailing<Capitalize<R>, D>}` extends `${infer U1 extends D | Digit}${infer R1}` ? U1 extends D ? `${U}${U1}${_SnakeToCamelWithTailing<Capitalize<R1>, D>}` : `${U}${U1}${_SnakeToCamelWithTailing<R1, D>}` : `${_SnakeToCamelWithTailing<Capitalize<R>, D>}` : `${U}${_SnakeToCamelWithTailing<R, D>}` : T;
export type SnakeToPascal<T extends string, D extends string = '_'> = string extends D ? never : T extends `${infer F extends D}${infer R}` ? `${F}${SnakeToPascal<R, D>}` : _SnakeToCamelWithTailing<Capitalize<T>, D>;
export type CamelKeys<T, D extends string = '_', Recursive extends boolean = false> = T extends object ? _CamelKeys<T, D, Recursive> : never;

@@ -14,0 +15,0 @@ type _CamelKeys<T, D extends string = '_', Recursive extends boolean = false> = Recursive extends true ? RecursiveCamelKeys<T, D> : RecordCamelKeys<T, D>;

{
"name": "@waiting/shared-types",
"author": "waiting",
"version": "20.13.0",
"version": "21.0.0",
"description": "shared typescript types",

@@ -51,3 +51,3 @@ "keywords": [

"scripts": {
"build": "npm run tsc && npm run rp",
"build": "npm run tsc && tsc-alias && npm run rp",
"clean": "npm run clean:lock & npm run clean:cache & rm -rf dist/* -rf",

@@ -63,6 +63,5 @@ "clean:cache": "rm -rf .eslintcache .vscode/.tsbuildinfo .vscode/.tsbuildinfo.*",

"test:local": "cross-env TS_NODE_PROJECT=test/tsconfig.json ../../node_modules/.bin/mocha --loader=ts-node/esm --parallel=false",
"tsc": "tsc -b ",
"tsc:w": "tsc -p tsconfig.json -w"
"tsc": "tsc -b "
},
"gitHead": "88133dc03b3df986fa8ae4944cd7abcee857ec8e"
"gitHead": "f5b91437b1088473eedd52b16cf9561f5129d39d"
}

@@ -39,2 +39,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

export type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'

@@ -51,3 +52,3 @@ export type CamelToSnake<

type _CamelToSnake<T extends string, D extends string> = T extends `${infer U}${infer Rest}`
? U extends D
? U extends D | Digit
? `${U}${_CamelToSnake<Rest, D>}`

@@ -62,21 +63,27 @@ : Uppercase<U> extends U

T extends string,
D extends string = '_',
TrimStart extends boolean = false,
TrimEnd extends boolean = false>
= string extends D
? never
: T extends `${infer F extends D}${infer R}`
? TrimStart extends true
? `${SnakeToCamel<R, D, true, TrimEnd>}`
: `${F}${SnakeToCamel<R, D, false, TrimEnd>}`
: TrimEnd extends true
? _SnakeToCamelWoTailing<T, D>
: _SnakeToCamelWithTailing<T, D>
D extends string = '_'
> = string extends D
? never
: T extends `${infer F extends D}${infer R}`
? `${F}${SnakeToCamel<R, D>}`
: _SnakeToCamel<T, D>
type _SnakeToCamelWoTailing<T extends string, D extends string> = T extends `${infer U}${infer R}`
? U extends D
? `${_SnakeToCamelWoTailing<Capitalize<R>, D>}`
: `${U}${_SnakeToCamelWoTailing<R, D>}`
: T
// type _SnakeToCamelWoTailing<T extends string, D extends string> = T extends `${infer U}${infer R}`
// ? U extends D
// ? `${_SnakeToCamelWoTailing<Capitalize<R>, D>}`
// : `${U}${_SnakeToCamelWoTailing<R, D>}`
// : T
// type SnakeToCamelNoPrefix<
// T extends string,
// D extends string = '_'
// > = string extends D ? never : TrimStart<_SnakeToCamelWithTailing<T, D>, D>
// type SnakeToCamelNoSuffix<
// T extends string,
// D extends string = '_'
// > = string extends D ? never : TrimEnd<_SnakeToCamelWithTailing<T, D>, D>
type _SnakeToCamel<T extends string, D extends string> = _SnakeToCamelWithTailing<T, D>
type _SnakeToCamelWithTailing<T extends string, D extends string> = T extends `${infer U}${infer R}`

@@ -86,4 +93,6 @@ ? R extends ''

: U extends D
? `${_SnakeToCamelWithTailing<Capitalize<R>, D>}` extends `${infer U1 extends D}${infer R1}`
? `${U}${U1}${_SnakeToCamelWithTailing<Capitalize<R1>, D>}`
? `${_SnakeToCamelWithTailing<Capitalize<R>, D>}` extends `${infer U1 extends D | Digit}${infer R1}`
? U1 extends D
? `${U}${U1}${_SnakeToCamelWithTailing<Capitalize<R1>, D>}`
: `${U}${U1}${_SnakeToCamelWithTailing<R1, D>}`
: `${_SnakeToCamelWithTailing<Capitalize<R>, D>}`

@@ -95,14 +104,8 @@ : `${U}${_SnakeToCamelWithTailing<R, D>}`

T extends string,
D extends string = '_',
TrimStart extends boolean = false,
TrimEnd extends boolean = false>
= string extends D
? never
: T extends `${infer F extends D}${infer R}`
? TrimStart extends true
? `${Capitalize<SnakeToPascal<R, D, true, TrimEnd>>}`
: `${F}${Capitalize<SnakeToPascal<R, D, false, TrimEnd>>}`
: TrimEnd extends true
? _SnakeToCamelWoTailing<Capitalize<T>, D>
: _SnakeToCamelWithTailing<Capitalize<T>, D>
D extends string = '_'
> = string extends D
? never
: T extends `${infer F extends D}${infer R}`
? `${F}${SnakeToPascal<R, D>}`
: _SnakeToCamelWithTailing<Capitalize<T>, D>

@@ -113,6 +116,6 @@

D extends string = '_',
Recursive extends boolean = false>
= T extends object
? _CamelKeys<T, D, Recursive>
: never
Recursive extends boolean = false
> = T extends object
? _CamelKeys<T, D, Recursive>
: never

@@ -119,0 +122,0 @@ type _CamelKeys<

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc