@demicodes/utils 0.3.1 → 0.4.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.
- package/dist/index.d.mts +5 -1
- package/package.json +1 -2
package/dist/index.d.mts
CHANGED
|
@@ -98,6 +98,10 @@ declare function tail(text: string, maxChars: number): string;
|
|
|
98
98
|
declare function shortHash(value: string): string;
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/json.d.ts
|
|
101
|
+
/** Values preserved by Demi's transport-neutral portable JSON codec. */
|
|
102
|
+
type PortableJsonValue = null | boolean | number | string | bigint | Uint8Array | readonly PortableJsonValue[] | {
|
|
103
|
+
readonly [key: string]: PortableJsonValue;
|
|
104
|
+
};
|
|
101
105
|
/** Parses JSON, returning the value, or the original string if it is not valid JSON. */
|
|
102
106
|
declare function parseJsonOrString(value: string): unknown;
|
|
103
107
|
/** Parses JSON and returns it only when it is a plain object; otherwise `null`. */
|
|
@@ -133,4 +137,4 @@ declare function isAbsolutePath(path: string): boolean;
|
|
|
133
137
|
/** Generates a random UUID. */
|
|
134
138
|
declare function createId(): string;
|
|
135
139
|
//#endregion
|
|
136
|
-
export { AbortError, Deferred, abortable, asError, asRecord, asString, base64ToBytes, bytesToBase64, clamp, concatBytes, createId, decodeLatin1, decodeUtf8, decodeUtf8Strict, deferred, delay, dirnamePath, encodeLatin1, encodeUtf8, errorCode, errorMessage, isAbortError, isAbsolutePath, isFileNotFoundError, isRecord, nonEmptyString, noop, normalizeBaseUrl, normalizePath, numberOrNull, numberOrZero, parseJsonObject, parseJsonOrString, parsePortableJson, safeJsonStringify, shortHash, stringOrNull, stringifyPortableJson, tail, throwIfAborted, truncate, utf8Bytes, utf8Slice, waitFor, withTimeout };
|
|
140
|
+
export { AbortError, Deferred, PortableJsonValue, abortable, asError, asRecord, asString, base64ToBytes, bytesToBase64, clamp, concatBytes, createId, decodeLatin1, decodeUtf8, decodeUtf8Strict, deferred, delay, dirnamePath, encodeLatin1, encodeUtf8, errorCode, errorMessage, isAbortError, isAbsolutePath, isFileNotFoundError, isRecord, nonEmptyString, noop, normalizeBaseUrl, normalizePath, numberOrNull, numberOrZero, parseJsonObject, parseJsonOrString, parsePortableJson, safeJsonStringify, shortHash, stringOrNull, stringifyPortableJson, tail, throwIfAborted, truncate, utf8Bytes, utf8Slice, waitFor, withTimeout };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@demicodes/utils",
|
|
3
3
|
"description": "Shared zero-dependency utilities for Demi (type guards, errors, async, bytes, strings, paths, JSON).",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.mjs",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"types": "./dist/index.d.mts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"development": "./src/index.ts",
|
|
13
12
|
"types": "./dist/index.d.mts",
|
|
14
13
|
"import": "./dist/index.mjs"
|
|
15
14
|
}
|