@orpc/shared
Advanced tools
Comparing version 0.0.0-next.b2e67f7 to 0.0.0-next.b36125c
@@ -51,2 +51,5 @@ // src/object.ts | ||
} | ||
function isTypescriptObject(value2) { | ||
return !!value2 && (typeof value2 === "object" || typeof value2 === "function"); | ||
} | ||
@@ -72,2 +75,15 @@ // src/error.ts | ||
// src/function.ts | ||
function once(fn) { | ||
let cached; | ||
return () => { | ||
if (cached) { | ||
return cached.result; | ||
} | ||
const result = fn(); | ||
cached = { result }; | ||
return result; | ||
}; | ||
} | ||
// src/interceptor.ts | ||
@@ -127,2 +143,21 @@ function onStart(callback) { | ||
// src/iterator.ts | ||
function isAsyncIteratorObject(maybe) { | ||
if (!maybe || typeof maybe !== "object") { | ||
return false; | ||
} | ||
return Symbol.asyncIterator in maybe && typeof maybe[Symbol.asyncIterator] === "function"; | ||
} | ||
// src/json.ts | ||
function parseEmptyableJSON(text) { | ||
if (!text) { | ||
return void 0; | ||
} | ||
return JSON.parse(text); | ||
} | ||
function stringifyJSON(value2) { | ||
return JSON.stringify(value2); | ||
} | ||
// src/value.ts | ||
@@ -144,3 +179,5 @@ function value(value2, ...args) { | ||
intercept, | ||
isAsyncIteratorObject, | ||
isObject, | ||
isTypescriptObject, | ||
mapEntries, | ||
@@ -153,4 +190,7 @@ mapValues, | ||
onSuccess, | ||
once, | ||
parseEmptyableJSON, | ||
retry, | ||
set, | ||
stringifyJSON, | ||
toError, | ||
@@ -157,0 +197,0 @@ trim, |
export type AnyFunction = (...args: any[]) => any; | ||
export declare function once<T extends () => any>(fn: T): () => ReturnType<T>; | ||
//# sourceMappingURL=function.d.ts.map |
@@ -5,2 +5,4 @@ export * from './chain'; | ||
export * from './interceptor'; | ||
export * from './iterator'; | ||
export * from './json'; | ||
export * from './object'; | ||
@@ -7,0 +9,0 @@ export * from './types'; |
@@ -12,2 +12,6 @@ export type Segment = string | number; | ||
export declare function isObject(value: unknown): value is Record<PropertyKey, unknown>; | ||
/** | ||
* Check if the value satisfy a `object` type in typescript | ||
*/ | ||
export declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>; | ||
//# sourceMappingURL=object.d.ts.map |
{ | ||
"name": "@orpc/shared", | ||
"type": "module", | ||
"version": "0.0.0-next.b2e67f7", | ||
"version": "0.0.0-next.b36125c", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "homepage": "https://orpc.unnoq.com", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15857
14
272
0