inferred-types 0.41.4 → 0.42.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.
@@ -0,0 +1,15 @@
1
+ import { EnsureTrailing } from "../../types/string-literals";
2
+ import { EnsureLeading } from "../../types/string-literals/EnsureLeading";
3
+ export type EnsureSurround<TPrefix extends string, TPostfix extends string> = <TInput extends string>(input: TInput) => EnsureTrailing<EnsureLeading<TInput, TPrefix>, TPostfix>;
4
+ /**
5
+ * **ensureSurround**(prefix, postfix) -> (input) -> `${prefix}${input}${postfix}`
6
+ *
7
+ * A higher order runtime utility which receives a prefix and postfix string
8
+ * on it's first call. This returns a secondary function which will _ensure_
9
+ * the given prefix/postfix's surround the input (without duplicating the
10
+ * prefix/postfix characters if they were already there).
11
+ *
12
+ * **Related:** `surround()`
13
+ */
14
+ export declare function ensureSurround<TPrefix extends string, TPostfix extends string>(prefix: TPrefix, postfix: TPostfix): EnsureSurround<TPrefix, TPostfix>;
15
+ //# sourceMappingURL=ensureSurround.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSurround.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/ensureSurround.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oCAAkC;AAC3D,OAAO,EAAE,aAAa,EAAE,kDAAgD;AAKxE,MAAM,MAAM,cAAc,CACxB,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,MAAM,IACrB,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,cAAc,CAC1D,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,QAAQ,CACT,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,MAAM,EACvB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAGvE"}
@@ -0,0 +1,15 @@
1
+ import { ensureLeading } from "./ensureLeading.js";
2
+ import { ensureTrailing } from "./ensureTrailing.js";
3
+ /**
4
+ * **ensureSurround**(prefix, postfix) -> (input) -> `${prefix}${input}${postfix}`
5
+ *
6
+ * A higher order runtime utility which receives a prefix and postfix string
7
+ * on it's first call. This returns a secondary function which will _ensure_
8
+ * the given prefix/postfix's surround the input (without duplicating the
9
+ * prefix/postfix characters if they were already there).
10
+ *
11
+ * **Related:** `surround()`
12
+ */
13
+ export function ensureSurround(prefix, postfix) {
14
+ return (input) => ensureTrailing(ensureLeading(input, prefix), postfix);
15
+ }
@@ -5,6 +5,7 @@ export * from "./stripTrailing";
5
5
  export * from "./stripLeading";
6
6
  export * from "./ensureTrailing";
7
7
  export * from "./ensureLeading";
8
+ export * from "./ensureSurround";
8
9
  export * from "./ifUppercase";
9
10
  export * from "./pathJoin";
10
11
  export * from "./narrow";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/index.ts"],"names":[],"mappings":"AAMA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/index.ts"],"names":[],"mappings":"AAMA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
@@ -10,6 +10,7 @@ export * from "./stripTrailing.js";
10
10
  export * from "./stripLeading.js";
11
11
  export * from "./ensureTrailing.js";
12
12
  export * from "./ensureLeading.js";
13
+ export * from "./ensureSurround.js";
13
14
  export * from "./ifUppercase.js";
14
15
  export * from "./pathJoin.js";
15
16
  export * from "./narrow.js";
@@ -5,6 +5,8 @@ export type SurroundWith<TPrefix extends string, TPostfix extends string> = <TIn
5
5
  * A higher order runtime utility which receives a prefix and postfix string
6
6
  * on it's first call. This returns a secondary function which will _surround_
7
7
  * the given input with the prefix and postfix strings.
8
+ *
9
+ * **Related:** `ensureSurround()`
8
10
  */
9
11
  export declare function surround<TPrefix extends string, TPostfix extends string>(prefix: TPrefix, postfix: TPostfix): SurroundWith<TPrefix, TPostfix>;
10
12
  //# sourceMappingURL=surround.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surround.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/surround.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,CACxB,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,MAAM,IACnB,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,EAAE,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,MAAM,EACvB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAErE"}
1
+ {"version":3,"file":"surround.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/surround.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,CACxB,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,MAAM,IACnB,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,EAAE,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,MAAM,EACvB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAErE"}
@@ -4,6 +4,8 @@
4
4
  * A higher order runtime utility which receives a prefix and postfix string
5
5
  * on it's first call. This returns a secondary function which will _surround_
6
6
  * the given input with the prefix and postfix strings.
7
+ *
8
+ * **Related:** `ensureSurround()`
7
9
  */
8
10
  export function surround(prefix, postfix) {
9
11
  return (input) => `${prefix}${input}${postfix}`;