inferred-types 0.55.16 → 0.55.17

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.
@@ -13326,33 +13326,6 @@ type JsonValues<T extends Tuple> = {
13326
13326
  [K in keyof T]: JsonValue<T[K]>;
13327
13327
  };
13328
13328
 
13329
- /**
13330
- * **Replace**`<TText,TFind,TReplace>`
13331
- *
13332
- * Type utility which takes a string `TText` and finds the first instance of
13333
- * `TFind` and replaces it with `TReplace`.
13334
- *
13335
- * ```ts
13336
- * const fooy = "fooy";
13337
- * // "Foo"
13338
- * type Foo = Replace<typeof fooy, "y", "">;
13339
- * ```
13340
- *
13341
- * **Related:** `ReplaceAll`
13342
- */
13343
- type Replace<TText extends string, TFind extends string, TReplace extends string> = TText extends "" ? If<IsEqual<TFind, "">, TReplace, ""> : TFind extends "" ? TText : TText extends `${infer F}${TFind}${infer E}` ? `${F}${TReplace}${E}` : TText;
13344
-
13345
- /**
13346
- * Trims off whitespace on left of string
13347
- * ```ts
13348
- * // "foobar "
13349
- * type T = TrimLeft<"\n\t foobar ">;
13350
- * // string
13351
- * type T = TrimLeft<string>;
13352
- * ```
13353
- */
13354
- type TrimLeft<S extends string> = string extends S ? string : S extends `${Whitespace}${infer Right}` ? TrimLeft<Right> : S;
13355
-
13356
13329
  /**
13357
13330
  * Provides the _left_ whitespace of a string
13358
13331
  * ```ts
@@ -13579,6 +13552,22 @@ type RemoveIndex<T extends Record<any, any>> = {
13579
13552
  [P in keyof T as string extends P ? never : number extends P ? never : symbol extends P ? never : P]: T[P];
13580
13553
  };
13581
13554
 
13555
+ /**
13556
+ * **Replace**`<TText,TFind,TReplace>`
13557
+ *
13558
+ * Type utility which takes a string `TText` and finds the first instance of
13559
+ * `TFind` and replaces it with `TReplace`.
13560
+ *
13561
+ * ```ts
13562
+ * const fooy = "fooy";
13563
+ * // "Foo"
13564
+ * type Foo = Replace<typeof fooy, "y", "">;
13565
+ * ```
13566
+ *
13567
+ * **Related:** `ReplaceAll`
13568
+ */
13569
+ type Replace<TText extends string, TFind extends string, TReplace extends string> = TText extends "" ? If<IsEqual<TFind, "">, TReplace, ""> : TFind extends "" ? TText : TText extends `${infer F}${TFind}${infer E}` ? `${F}${TReplace}${E}` : TText;
13570
+
13582
13571
  type Process$J<TText extends string, TFind extends string, TReplace extends string> = Replace<TText, TFind, TReplace> extends `${string}${TFind}${string}` ? Process$J<Replace<TText, TFind, TReplace>, TFind, TReplace> : Replace<TText, TFind, TReplace>;
13583
13572
  type Iterate$2<TText extends string, TFind extends readonly string[], TReplace extends string> = [] extends TFind ? TText : Iterate$2<Process$J<TText, First<TFind>, TReplace>, AfterFirst<TFind>, TReplace>;
13584
13573
  type Singular<TText extends string, TFind extends string, TReplace extends string> = IsStringLiteral<TText> extends true ? IsStringLiteral<TFind> extends true ? IsUnion<TFind> extends true ? UnionToTuple$1<TFind> extends readonly string[] ? Iterate$2<TText, UnionToTuple$1<TFind>, TReplace> : never : Process$J<TText, TFind, TReplace> : string : string;
@@ -13633,17 +13622,6 @@ type ProcessTuple$2<TArray extends readonly unknown[] | unknown[], TResults exte
13633
13622
  */
13634
13623
  type ReturnValues<TContainer extends readonly unknown[] | Dictionary> = TContainer extends readonly unknown[] ? ProcessTuple$2<TContainer> : TContainer extends Dictionary ? ProcessTuple$2<Values<TContainer>> : never;
13635
13624
 
13636
- /**
13637
- * Trims off whitespace on left of string
13638
- * ```ts
13639
- * // "\n foobar"
13640
- * type T = TrimRight<"\n foobar \t">;
13641
- * // string
13642
- * type T = TrimRight<string>;
13643
- * ```
13644
- */
13645
- type TrimRight<S extends string> = string extends S ? string : S extends `${infer Right}${Whitespace}` ? TrimRight<Right> : S;
13646
-
13647
13625
  /**
13648
13626
  * Provides the _left_ whitespace of a string
13649
13627
  * ```ts
@@ -13815,6 +13793,28 @@ type Process$G<S extends string> = string extends S ? string : S extends `${Whit
13815
13793
  */
13816
13794
  type Trim<S extends string> = Process$G<S> extends string ? Process$G<S> : never;
13817
13795
 
13796
+ /**
13797
+ * Trims off whitespace on left of string
13798
+ * ```ts
13799
+ * // "foobar "
13800
+ * type T = TrimLeft<"\n\t foobar ">;
13801
+ * // string
13802
+ * type T = TrimLeft<string>;
13803
+ * ```
13804
+ */
13805
+ type TrimLeft<S extends string> = string extends S ? string : S extends `${Whitespace}${infer Right}` ? TrimLeft<Right> : S;
13806
+
13807
+ /**
13808
+ * Trims off whitespace on left of string
13809
+ * ```ts
13810
+ * // "\n foobar"
13811
+ * type T = TrimRight<"\n foobar \t">;
13812
+ * // string
13813
+ * type T = TrimRight<string>;
13814
+ * ```
13815
+ */
13816
+ type TrimRight<S extends string> = string extends S ? string : S extends `${infer Right}${Whitespace}` ? TrimRight<Right> : S;
13817
+
13818
13818
  /**
13819
13819
  * **ElementOf**`<T>`
13820
13820
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inferred-types",
3
- "version": "0.55.16",
3
+ "version": "0.55.17",
4
4
  "description": "Functions which provide useful type inference on TS projects",
5
5
  "license": "MIT",
6
6
  "author": "Ken Snyder<ken@ken.net>",