mcbe-leveldb 1.16.0-jsonly → 1.17.0-jsonly

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcbe-leveldb",
3
- "version": "1.16.0-jsonly",
3
+ "version": "1.17.0-jsonly",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "prepublishOnly": "tsc -p ./tsconfig.production.json",
package/types.d.ts CHANGED
@@ -179,11 +179,30 @@ export type Join<T extends string[], J extends string = ""> =
179
179
  *
180
180
  * @example
181
181
  * ```ts
182
- * type Original = CutFirstChars<"abcdef", 2>; // "cdef"
182
+ * type Original = CutFirstChars<"abcdef", 2>; // "abcd"
183
183
  * ```
184
184
  */
185
185
  export type CutFirstChars<S extends string, N extends number, SArray = TakeFirstNElements<Split<S>, N>> = Join<SArray extends string[] ? SArray : never>;
186
186
 
187
+ /**
188
+ * Slices a string.
189
+ *
190
+ * @template S The string to slice.
191
+ * @template N The start index.
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * type Original = SliceString<"abcdef", 2>; // "cdef"
196
+ * ```
197
+ *
198
+ * @see https://stackoverflow.com/a/79693198/16872762
199
+ * @author Eric B <https://stackoverflow.com/users/8594404/eric-b>
200
+ */
201
+ export type SliceString<Input extends string, Start extends number, Counter extends any[] = []> =
202
+ Counter["length"] extends Start ? Input
203
+ : Input extends `${infer _}${infer Rest}` ? SliceString<Rest, Start, [...Counter, any]>
204
+ : never;
205
+
187
206
  /**
188
207
  * Mutates the type by removing the optional modifier (`?`) from all properties.
189
208
  *