Fix StartOS 0.4 TypeScript packaging to match SDK API
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringify = stringify;
|
||||
exports.chain = chain;
|
||||
/**
|
||||
* Format an unknown value to a string for display
|
||||
*/
|
||||
function stringify(value) {
|
||||
if (value !== null && typeof value === 'object') {
|
||||
// For objects, defer an overridden toString, otherwise use JSON.stringify
|
||||
return 'toString' in value && ![Object.prototype.toString, Array.prototype.toString].includes(value.toString)
|
||||
? value.toString()
|
||||
: JSON.stringify(value);
|
||||
}
|
||||
else {
|
||||
return String(value);
|
||||
}
|
||||
}
|
||||
function chain(functions) {
|
||||
const [head, ...tail] = functions;
|
||||
return (...args) => {
|
||||
return tail.reduce((acc, fn) => fn(acc), head(...args));
|
||||
};
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/no-explicit-any */
|
||||
Reference in New Issue
Block a user