@dxos/util 0.8.4-main.fd6878d → 0.8.4-main.fffef41
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/lib/browser/index.mjs +226 -94
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +226 -94
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/di-key.d.ts +3 -3
- package/dist/types/src/di-key.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/safe-parse.d.ts.map +1 -1
- package/dist/types/src/safe-stringify.d.ts +13 -0
- package/dist/types/src/safe-stringify.d.ts.map +1 -0
- package/dist/types/src/string.d.ts +4 -0
- package/dist/types/src/string.d.ts.map +1 -1
- package/dist/types/src/to-fallback.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/unit.d.ts +14 -0
- package/dist/types/src/unit.d.ts.map +1 -0
- package/dist/types/src/unit.test.d.ts +2 -0
- package/dist/types/src/unit.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/binder.ts +2 -2
- package/src/index.ts +2 -1
- package/src/safe-parse.ts +4 -3
- package/src/safe-stringify.ts +104 -0
- package/src/string.ts +7 -0
- package/src/to-fallback.ts +5 -4
- package/src/types.ts +1 -1
- package/src/unit.test.ts +25 -0
- package/src/unit.ts +82 -0
- package/dist/types/src/first-two-chars.d.ts +0 -9
- package/dist/types/src/first-two-chars.d.ts.map +0 -1
- package/src/first-two-chars.ts +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/array-to-hex.ts":{"bytes":2461,"imports":[],"format":"esm"},"src/array.ts":{"bytes":11369,"imports":[],"format":"esm"},"src/assume.ts":{"bytes":1335,"imports":[],"format":"esm"},"src/binder.ts":{"bytes":1310,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/bitfield.ts":{"bytes":8453,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/callback-collection.ts":{"bytes":3170,"imports":[],"format":"esm"},"src/callback.ts":{"bytes":5204,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/case.ts":{"bytes":4574,"imports":[],"format":"esm"},"src/chunk-array.ts":{"bytes":1195,"imports":[],"format":"esm"},"src/circular-buffer.ts":{"bytes":6257,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/clear-undefined.ts":{"bytes":1554,"imports":[],"format":"esm"},"src/complex.ts":{"bytes":21800,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/deep.ts":{"bytes":3983,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/defer-function.ts":{"bytes":1558,"imports":[],"format":"esm"},"src/explicit-resource-management-polyfill.ts":{"bytes":1429,"imports":[],"format":"esm"},"src/defer.ts":{"bytes":3674,"imports":[{"path":"src/explicit-resource-management-polyfill.ts","kind":"import-statement","original":"./explicit-resource-management-polyfill"}],"format":"esm"},"src/entry.ts":{"bytes":3002,"imports":[],"format":"esm"},"src/first-two-chars.ts":{"bytes":4855,"imports":[],"format":"esm"},"src/for-each-async.ts":{"bytes":785,"imports":[],"format":"esm"},"src/human-hash.ts":{"bytes":19761,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/map.ts":{"bytes":1489,"imports":[],"format":"esm"},"src/instance-id.ts":{"bytes":4222,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/interval.ts":{"bytes":1819,"imports":[],"format":"esm"},"src/join-tables.ts":{"bytes":3063,"imports":[],"format":"esm"},"src/uint8array.ts":{"bytes":3745,"imports":[],"format":"esm"},"src/json.ts":{"bytes":13272,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"}],"format":"esm"},"src/map-values.ts":{"bytes":13207,"imports":[],"format":"esm"},"src/no-infer.ts":{"bytes":474,"imports":[],"format":"esm"},"src/object.ts":{"bytes":1070,"imports":[],"format":"esm"},"src/order-keys.ts":{"bytes":1598,"imports":[],"format":"esm"},"src/order.ts":{"bytes":4971,"imports":[],"format":"esm"},"src/pick.ts":{"bytes":3648,"imports":[],"format":"esm"},"src/platform.ts":{"bytes":11239,"imports":[],"format":"esm"},"src/position.ts":{"bytes":2499,"imports":[],"format":"esm"},"src/random.ts":{"bytes":1303,"imports":[],"format":"esm"},"src/range.ts":{"bytes":2611,"imports":[],"format":"esm"},"src/reducers.ts":{"bytes":12812,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/remove-undefined-keys.ts":{"bytes":4560,"imports":[],"format":"esm"},"src/safe-await.ts":{"bytes":2843,"imports":[],"format":"esm"},"src/safe-instanceof.ts":{"bytes":2680,"imports":[],"format":"esm"},"src/safe-parse.ts":{"bytes":2848,"imports":[],"format":"esm"},"src/sliding-window-summary.ts":{"bytes":7509,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"}],"format":"esm"},"src/sort.ts":{"bytes":3931,"imports":[],"format":"esm"},"src/string.ts":{"bytes":4873,"imports":[],"format":"esm"},"src/sum.ts":{"bytes":675,"imports":[],"format":"esm"},"src/throw-unhandled-error.ts":{"bytes":1163,"imports":[],"format":"esm"},"src/to-fallback.ts":{"bytes":13973,"imports":[],"format":"esm"},"src/tracer.ts":{"bytes":7225,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/tree.ts":{"bytes":6250,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":8514,"imports":[],"format":"esm"},"src/url.ts":{"bytes":1627,"imports":[],"format":"esm"},"src/weak.ts":{"bytes":9591,"imports":[],"format":"esm"},"src/index.ts":{"bytes":4992,"imports":[{"path":"src/array-to-hex.ts","kind":"import-statement","original":"./array-to-hex"},{"path":"src/array.ts","kind":"import-statement","original":"./array"},{"path":"src/assume.ts","kind":"import-statement","original":"./assume"},{"path":"src/binder.ts","kind":"import-statement","original":"./binder"},{"path":"src/bitfield.ts","kind":"import-statement","original":"./bitfield"},{"path":"src/callback-collection.ts","kind":"import-statement","original":"./callback-collection"},{"path":"src/callback.ts","kind":"import-statement","original":"./callback"},{"path":"src/case.ts","kind":"import-statement","original":"./case"},{"path":"src/chunk-array.ts","kind":"import-statement","original":"./chunk-array"},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"},{"path":"src/clear-undefined.ts","kind":"import-statement","original":"./clear-undefined"},{"path":"src/complex.ts","kind":"import-statement","original":"./complex"},{"path":"src/deep.ts","kind":"import-statement","original":"./deep"},{"path":"src/defer-function.ts","kind":"import-statement","original":"./defer-function"},{"path":"src/defer.ts","kind":"import-statement","original":"./defer"},{"path":"src/entry.ts","kind":"import-statement","original":"./entry"},{"path":"src/first-two-chars.ts","kind":"import-statement","original":"./first-two-chars"},{"path":"src/for-each-async.ts","kind":"import-statement","original":"./for-each-async"},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/instance-id.ts","kind":"import-statement","original":"./instance-id"},{"path":"src/interval.ts","kind":"import-statement","original":"./interval"},{"path":"src/join-tables.ts","kind":"import-statement","original":"./join-tables"},{"path":"src/json.ts","kind":"import-statement","original":"./json"},{"path":"src/map-values.ts","kind":"import-statement","original":"./map-values"},{"path":"src/map.ts","kind":"import-statement","original":"./map"},{"path":"src/no-infer.ts","kind":"import-statement","original":"./no-infer"},{"path":"src/object.ts","kind":"import-statement","original":"./object"},{"path":"src/order-keys.ts","kind":"import-statement","original":"./order-keys"},{"path":"src/order.ts","kind":"import-statement","original":"./order"},{"path":"src/pick.ts","kind":"import-statement","original":"./pick"},{"path":"src/platform.ts","kind":"import-statement","original":"./platform"},{"path":"src/position.ts","kind":"import-statement","original":"./position"},{"path":"src/random.ts","kind":"import-statement","original":"./random"},{"path":"src/range.ts","kind":"import-statement","original":"./range"},{"path":"src/reducers.ts","kind":"import-statement","original":"./reducers"},{"path":"src/remove-undefined-keys.ts","kind":"import-statement","original":"./remove-undefined-keys"},{"path":"src/safe-await.ts","kind":"import-statement","original":"./safe-await"},{"path":"src/safe-instanceof.ts","kind":"import-statement","original":"./safe-instanceof"},{"path":"src/safe-parse.ts","kind":"import-statement","original":"./safe-parse"},{"path":"src/sliding-window-summary.ts","kind":"import-statement","original":"./sliding-window-summary"},{"path":"src/sort.ts","kind":"import-statement","original":"./sort"},{"path":"src/string.ts","kind":"import-statement","original":"./string"},{"path":"src/sum.ts","kind":"import-statement","original":"./sum"},{"path":"src/throw-unhandled-error.ts","kind":"import-statement","original":"./throw-unhandled-error"},{"path":"src/to-fallback.ts","kind":"import-statement","original":"./to-fallback"},{"path":"src/tracer.ts","kind":"import-statement","original":"./tracer"},{"path":"src/tree.ts","kind":"import-statement","original":"./tree"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/weak.ts","kind":"import-statement","original":"./weak"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":132409},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["BitField","Callback","CallbackCollection","CircularBuffer","ComplexMap","ComplexSet","HumanHasher","MapEntry","SlidingWindowSummary","Tracer","WeakDictionary","accessBy","arrayMove","arrayToBuffer","arrayToHex","arrayToString","arraysEqual","assumeType","bufferToArray","byPosition","capitalize","chunkArray","clamp","clearUndefined","compareMulti","compareObject","compareScalar","compareString","createBinder","createBucketReducer","createGroupReducer","createSetDispatch","createUrl","decamelize","deepMapValues","deepMapValuesAsync","defaultMap","defer","deferAsync","deferFunction","diff","distinctBy","doAsync","entries","entry","exponentialBackoffInterval","forEachAsync","get","getAsyncProviderValue","getDate","getDebugName","getDeep","getFirstTwoRenderableChars","getHostPlatform","getPrototypeSpecificInstanceId","getProviderValue","hexToEmoji","hexToFallback","hexToHue","humanize","hyphenize","idEmoji","idHue","inferObjectOrder","inferRecordOrder","intersectBy","intersection","iosCheck","isNode","isNonNullable","isNotFalsy","joinTables","jsonKeyReplacer","jsonReplacer","jsonify","jsonlogify","keyToEmoji","keyToFallback","keyToHue","keys","makeMap","makeSet","mapValues","median","mobileAndTabletCheck","numericalValues","omit","orderKeys","partition","pick","pickBy","randomInt","range","rangeFromTo","reduceGroupBy","reduceSeries","reduceSet","removeBy","removeProperties","removeUndefinedProperties","safariCheck","safeAwaitAll","safeInstanceof","safeParseFloat","safeParseInt","safeParseJson","set","setDeep","sortKeys","stringToArray","stringifyTree","stripUndefined","sum","throwUnhandledError","toEmoji","toFallback","toHue","tracer","trim","visitValues"],"entryPoint":"src/index.ts","inputs":{"src/array-to-hex.ts":{"bytesInOutput":341},"src/index.ts":{"bytesInOutput":0},"src/array.ts":{"bytesInOutput":1805},"src/assume.ts":{"bytesInOutput":31},"src/binder.ts":{"bytesInOutput":149},"src/bitfield.ts":{"bytesInOutput":1881},"src/callback-collection.ts":{"bytesInOutput":558},"src/callback.ts":{"bytesInOutput":1113},"src/case.ts":{"bytesInOutput":940},"src/chunk-array.ts":{"bytesInOutput":173},"src/circular-buffer.ts":{"bytesInOutput":1523},"src/clear-undefined.ts":{"bytesInOutput":223},"src/complex.ts":{"bytesInOutput":4492},"src/deep.ts":{"bytesInOutput":773},"src/defer-function.ts":{"bytesInOutput":72},"src/explicit-resource-management-polyfill.ts":{"bytesInOutput":100},"src/defer.ts":{"bytesInOutput":560},"src/entry.ts":{"bytesInOutput":487},"src/first-two-chars.ts":{"bytesInOutput":715},"src/for-each-async.ts":{"bytesInOutput":62},"src/human-hash.ts":{"bytesInOutput":5674},"src/map.ts":{"bytesInOutput":193},"src/instance-id.ts":{"bytesInOutput":784},"src/interval.ts":{"bytesInOutput":290},"src/join-tables.ts":{"bytesInOutput":493},"src/json.ts":{"bytesInOutput":2958},"src/uint8array.ts":{"bytesInOutput":562},"src/map-values.ts":{"bytesInOutput":2648},"src/object.ts":{"bytesInOutput":82},"src/order-keys.ts":{"bytesInOutput":266},"src/order.ts":{"bytesInOutput":676},"src/pick.ts":{"bytesInOutput":482},"src/platform.ts":{"bytesInOutput":3211},"src/position.ts":{"bytesInOutput":271},"src/random.ts":{"bytesInOutput":148},"src/range.ts":{"bytesInOutput":371},"src/reducers.ts":{"bytesInOutput":2326},"src/remove-undefined-keys.ts":{"bytesInOutput":935},"src/safe-await.ts":{"bytesInOutput":345},"src/safe-instanceof.ts":{"bytesInOutput":371},"src/safe-parse.ts":{"bytesInOutput":488},"src/sliding-window-summary.ts":{"bytesInOutput":1807},"src/sort.ts":{"bytesInOutput":643},"src/string.ts":{"bytesInOutput":814},"src/sum.ts":{"bytesInOutput":57},"src/throw-unhandled-error.ts":{"bytesInOutput":90},"src/to-fallback.ts":{"bytesInOutput":4324},"src/tracer.ts":{"bytesInOutput":1390},"src/tree.ts":{"bytesInOutput":1193},"src/types.ts":{"bytesInOutput":909},"src/url.ts":{"bytesInOutput":246},"src/weak.ts":{"bytesInOutput":2054}},"bytes":56088}}}
|
|
1
|
+
{"inputs":{"src/array-to-hex.ts":{"bytes":2461,"imports":[],"format":"esm"},"src/array.ts":{"bytes":11369,"imports":[],"format":"esm"},"src/assume.ts":{"bytes":1335,"imports":[],"format":"esm"},"src/binder.ts":{"bytes":1302,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/bitfield.ts":{"bytes":8453,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/callback-collection.ts":{"bytes":3170,"imports":[],"format":"esm"},"src/callback.ts":{"bytes":5204,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/case.ts":{"bytes":4574,"imports":[],"format":"esm"},"src/chunk-array.ts":{"bytes":1195,"imports":[],"format":"esm"},"src/circular-buffer.ts":{"bytes":6257,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/clear-undefined.ts":{"bytes":1554,"imports":[],"format":"esm"},"src/complex.ts":{"bytes":21712,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/deep.ts":{"bytes":3983,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/defer-function.ts":{"bytes":1558,"imports":[],"format":"esm"},"src/explicit-resource-management-polyfill.ts":{"bytes":1429,"imports":[],"format":"esm"},"src/defer.ts":{"bytes":3674,"imports":[{"path":"src/explicit-resource-management-polyfill.ts","kind":"import-statement","original":"./explicit-resource-management-polyfill"}],"format":"esm"},"src/entry.ts":{"bytes":3002,"imports":[],"format":"esm"},"src/for-each-async.ts":{"bytes":785,"imports":[],"format":"esm"},"src/human-hash.ts":{"bytes":19761,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/map.ts":{"bytes":1489,"imports":[],"format":"esm"},"src/instance-id.ts":{"bytes":4222,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/interval.ts":{"bytes":1819,"imports":[],"format":"esm"},"src/join-tables.ts":{"bytes":3063,"imports":[],"format":"esm"},"src/uint8array.ts":{"bytes":3745,"imports":[],"format":"esm"},"src/json.ts":{"bytes":13272,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"}],"format":"esm"},"src/map-values.ts":{"bytes":12881,"imports":[],"format":"esm"},"src/no-infer.ts":{"bytes":474,"imports":[],"format":"esm"},"src/object.ts":{"bytes":1070,"imports":[],"format":"esm"},"src/order-keys.ts":{"bytes":1598,"imports":[],"format":"esm"},"src/order.ts":{"bytes":4971,"imports":[],"format":"esm"},"src/pick.ts":{"bytes":3648,"imports":[],"format":"esm"},"src/platform.ts":{"bytes":11239,"imports":[],"format":"esm"},"src/position.ts":{"bytes":2499,"imports":[],"format":"esm"},"src/random.ts":{"bytes":1303,"imports":[],"format":"esm"},"src/range.ts":{"bytes":2611,"imports":[],"format":"esm"},"src/reducers.ts":{"bytes":12812,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/remove-undefined-keys.ts":{"bytes":4560,"imports":[],"format":"esm"},"src/safe-await.ts":{"bytes":2843,"imports":[],"format":"esm"},"src/safe-instanceof.ts":{"bytes":2680,"imports":[],"format":"esm"},"src/safe-parse.ts":{"bytes":2830,"imports":[],"format":"esm"},"src/safe-stringify.ts":{"bytes":8935,"imports":[],"format":"esm"},"src/sliding-window-summary.ts":{"bytes":7509,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"}],"format":"esm"},"src/sort.ts":{"bytes":3931,"imports":[],"format":"esm"},"src/string.ts":{"bytes":5646,"imports":[],"format":"esm"},"src/sum.ts":{"bytes":675,"imports":[],"format":"esm"},"src/throw-unhandled-error.ts":{"bytes":1163,"imports":[],"format":"esm"},"src/to-fallback.ts":{"bytes":14062,"imports":[],"format":"esm"},"src/tracer.ts":{"bytes":7225,"imports":[{"path":"src/map.ts","kind":"import-statement","original":"./map"}],"format":"esm"},"src/tree.ts":{"bytes":6250,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":8504,"imports":[],"format":"esm"},"src/unit.ts":{"bytes":8592,"imports":[],"format":"esm"},"src/url.ts":{"bytes":1627,"imports":[],"format":"esm"},"src/weak.ts":{"bytes":9591,"imports":[],"format":"esm"},"src/index.ts":{"bytes":5071,"imports":[{"path":"src/array-to-hex.ts","kind":"import-statement","original":"./array-to-hex"},{"path":"src/array.ts","kind":"import-statement","original":"./array"},{"path":"src/assume.ts","kind":"import-statement","original":"./assume"},{"path":"src/binder.ts","kind":"import-statement","original":"./binder"},{"path":"src/bitfield.ts","kind":"import-statement","original":"./bitfield"},{"path":"src/callback-collection.ts","kind":"import-statement","original":"./callback-collection"},{"path":"src/callback.ts","kind":"import-statement","original":"./callback"},{"path":"src/case.ts","kind":"import-statement","original":"./case"},{"path":"src/chunk-array.ts","kind":"import-statement","original":"./chunk-array"},{"path":"src/circular-buffer.ts","kind":"import-statement","original":"./circular-buffer"},{"path":"src/clear-undefined.ts","kind":"import-statement","original":"./clear-undefined"},{"path":"src/complex.ts","kind":"import-statement","original":"./complex"},{"path":"src/deep.ts","kind":"import-statement","original":"./deep"},{"path":"src/defer-function.ts","kind":"import-statement","original":"./defer-function"},{"path":"src/defer.ts","kind":"import-statement","original":"./defer"},{"path":"src/entry.ts","kind":"import-statement","original":"./entry"},{"path":"src/for-each-async.ts","kind":"import-statement","original":"./for-each-async"},{"path":"src/human-hash.ts","kind":"import-statement","original":"./human-hash"},{"path":"src/instance-id.ts","kind":"import-statement","original":"./instance-id"},{"path":"src/interval.ts","kind":"import-statement","original":"./interval"},{"path":"src/join-tables.ts","kind":"import-statement","original":"./join-tables"},{"path":"src/json.ts","kind":"import-statement","original":"./json"},{"path":"src/map-values.ts","kind":"import-statement","original":"./map-values"},{"path":"src/map.ts","kind":"import-statement","original":"./map"},{"path":"src/no-infer.ts","kind":"import-statement","original":"./no-infer"},{"path":"src/object.ts","kind":"import-statement","original":"./object"},{"path":"src/order-keys.ts","kind":"import-statement","original":"./order-keys"},{"path":"src/order.ts","kind":"import-statement","original":"./order"},{"path":"src/pick.ts","kind":"import-statement","original":"./pick"},{"path":"src/platform.ts","kind":"import-statement","original":"./platform"},{"path":"src/position.ts","kind":"import-statement","original":"./position"},{"path":"src/random.ts","kind":"import-statement","original":"./random"},{"path":"src/range.ts","kind":"import-statement","original":"./range"},{"path":"src/reducers.ts","kind":"import-statement","original":"./reducers"},{"path":"src/remove-undefined-keys.ts","kind":"import-statement","original":"./remove-undefined-keys"},{"path":"src/safe-await.ts","kind":"import-statement","original":"./safe-await"},{"path":"src/safe-instanceof.ts","kind":"import-statement","original":"./safe-instanceof"},{"path":"src/safe-parse.ts","kind":"import-statement","original":"./safe-parse"},{"path":"src/safe-stringify.ts","kind":"import-statement","original":"./safe-stringify"},{"path":"src/sliding-window-summary.ts","kind":"import-statement","original":"./sliding-window-summary"},{"path":"src/sort.ts","kind":"import-statement","original":"./sort"},{"path":"src/string.ts","kind":"import-statement","original":"./string"},{"path":"src/sum.ts","kind":"import-statement","original":"./sum"},{"path":"src/throw-unhandled-error.ts","kind":"import-statement","original":"./throw-unhandled-error"},{"path":"src/to-fallback.ts","kind":"import-statement","original":"./to-fallback"},{"path":"src/tracer.ts","kind":"import-statement","original":"./tracer"},{"path":"src/tree.ts","kind":"import-statement","original":"./tree"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/uint8array.ts","kind":"import-statement","original":"./uint8array"},{"path":"src/unit.ts","kind":"import-statement","original":"./unit"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/weak.ts","kind":"import-statement","original":"./weak"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":138900},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"lodash.set","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["BitField","Callback","CallbackCollection","CircularBuffer","ComplexMap","ComplexSet","HumanHasher","MapEntry","SKIP","SlidingWindowSummary","Tracer","Unit","WeakDictionary","accessBy","arrayMove","arrayToBuffer","arrayToHex","arrayToString","arraysEqual","assumeType","bufferToArray","byPosition","capitalize","chunkArray","clamp","clearUndefined","compareMulti","compareObject","compareScalar","compareString","createBinder","createBucketReducer","createGroupReducer","createReplacer","createSetDispatch","createUrl","decamelize","deepMapValues","deepMapValuesAsync","defaultFilter","defaultMap","defer","deferAsync","deferFunction","diff","distinctBy","doAsync","entries","entry","exponentialBackoffInterval","forEachAsync","get","getAsyncProviderValue","getDate","getDebugName","getDeep","getHostPlatform","getPrototypeSpecificInstanceId","getProviderValue","hexToEmoji","hexToFallback","hexToHue","humanize","hyphenize","idEmoji","idHue","inferObjectOrder","inferRecordOrder","intersectBy","intersection","iosCheck","isNode","isNonNullable","isTruthy","joinTables","jsonKeyReplacer","jsonReplacer","jsonify","jsonlogify","kebabize","keyToEmoji","keyToFallback","keyToHue","keys","makeMap","makeSet","mapValues","median","mobileAndTabletCheck","numericalValues","omit","orderKeys","partition","pick","pickBy","randomInt","range","rangeFromTo","reduceGroupBy","reduceSeries","reduceSet","removeBy","removeProperties","removeUndefinedProperties","safariCheck","safeAwaitAll","safeInstanceof","safeParseFloat","safeParseInt","safeParseJson","safeStringify","set","setDeep","sortKeys","stringToArray","stringifyTree","stripUndefined","sum","throwUnhandledError","toEmoji","toFallback","toHue","tracer","trim","visitValues"],"entryPoint":"src/index.ts","inputs":{"src/array-to-hex.ts":{"bytesInOutput":341},"src/index.ts":{"bytesInOutput":0},"src/array.ts":{"bytesInOutput":1805},"src/assume.ts":{"bytesInOutput":31},"src/binder.ts":{"bytesInOutput":153},"src/bitfield.ts":{"bytesInOutput":1881},"src/callback-collection.ts":{"bytesInOutput":558},"src/callback.ts":{"bytesInOutput":1113},"src/case.ts":{"bytesInOutput":940},"src/chunk-array.ts":{"bytesInOutput":173},"src/circular-buffer.ts":{"bytesInOutput":1523},"src/clear-undefined.ts":{"bytesInOutput":223},"src/complex.ts":{"bytesInOutput":4440},"src/deep.ts":{"bytesInOutput":773},"src/defer-function.ts":{"bytesInOutput":72},"src/defer.ts":{"bytesInOutput":560},"src/entry.ts":{"bytesInOutput":487},"src/for-each-async.ts":{"bytesInOutput":62},"src/human-hash.ts":{"bytesInOutput":5674},"src/map.ts":{"bytesInOutput":193},"src/instance-id.ts":{"bytesInOutput":784},"src/interval.ts":{"bytesInOutput":290},"src/join-tables.ts":{"bytesInOutput":493},"src/json.ts":{"bytesInOutput":2958},"src/uint8array.ts":{"bytesInOutput":562},"src/map-values.ts":{"bytesInOutput":2490},"src/object.ts":{"bytesInOutput":82},"src/order-keys.ts":{"bytesInOutput":266},"src/order.ts":{"bytesInOutput":676},"src/pick.ts":{"bytesInOutput":482},"src/platform.ts":{"bytesInOutput":3211},"src/position.ts":{"bytesInOutput":271},"src/random.ts":{"bytesInOutput":148},"src/range.ts":{"bytesInOutput":371},"src/reducers.ts":{"bytesInOutput":2326},"src/remove-undefined-keys.ts":{"bytesInOutput":935},"src/safe-await.ts":{"bytesInOutput":345},"src/safe-instanceof.ts":{"bytesInOutput":371},"src/safe-parse.ts":{"bytesInOutput":476},"src/safe-stringify.ts":{"bytesInOutput":1944},"src/sliding-window-summary.ts":{"bytesInOutput":1807},"src/sort.ts":{"bytesInOutput":643},"src/string.ts":{"bytesInOutput":925},"src/sum.ts":{"bytesInOutput":57},"src/throw-unhandled-error.ts":{"bytesInOutput":90},"src/to-fallback.ts":{"bytesInOutput":4324},"src/tracer.ts":{"bytesInOutput":1390},"src/tree.ts":{"bytesInOutput":1193},"src/types.ts":{"bytesInOutput":907},"src/unit.ts":{"bytesInOutput":2106},"src/url.ts":{"bytesInOutput":246},"src/weak.ts":{"bytesInOutput":2054}},"bytes":59228}}}
|
|
@@ -103,10 +103,10 @@ function assumeType(value) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/binder.ts
|
|
106
|
-
import
|
|
106
|
+
import { promisify } from "node:util";
|
|
107
107
|
var createBinder = (obj) => ({
|
|
108
108
|
fn: (fn) => fn.bind(obj),
|
|
109
|
-
async: (fn) =>
|
|
109
|
+
async: (fn) => promisify(fn.bind(obj))
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
// src/bitfield.ts
|
|
@@ -377,11 +377,10 @@ import { inspectObject, raise } from "@dxos/debug";
|
|
|
377
377
|
var MAX_SERIALIZATION_LENGTH = 10;
|
|
378
378
|
var ComplexSet = class {
|
|
379
379
|
_projection;
|
|
380
|
-
_values;
|
|
380
|
+
_values = /* @__PURE__ */ new Map();
|
|
381
381
|
// prettier-ignore
|
|
382
382
|
constructor(_projection, values) {
|
|
383
383
|
this._projection = _projection;
|
|
384
|
-
this._values = /* @__PURE__ */ new Map();
|
|
385
384
|
if (values) {
|
|
386
385
|
for (const value of values) {
|
|
387
386
|
this.add(value);
|
|
@@ -472,13 +471,11 @@ var makeSet = (projection) => {
|
|
|
472
471
|
};
|
|
473
472
|
var ComplexMap = class _ComplexMap {
|
|
474
473
|
_keyProjection;
|
|
475
|
-
_keys;
|
|
476
|
-
_values;
|
|
474
|
+
_keys = /* @__PURE__ */ new Map();
|
|
475
|
+
_values = /* @__PURE__ */ new Map();
|
|
477
476
|
// prettier-ignore
|
|
478
477
|
constructor(_keyProjection, entries2) {
|
|
479
478
|
this._keyProjection = _keyProjection;
|
|
480
|
-
this._keys = /* @__PURE__ */ new Map();
|
|
481
|
-
this._values = /* @__PURE__ */ new Map();
|
|
482
479
|
if (entries2) {
|
|
483
480
|
for (const [key, value] of entries2) {
|
|
484
481
|
this.set(key, value);
|
|
@@ -599,10 +596,6 @@ var getDeep = (obj, path) => {
|
|
|
599
596
|
// src/defer-function.ts
|
|
600
597
|
var deferFunction = (fnProvider) => (...args) => fnProvider()(...args);
|
|
601
598
|
|
|
602
|
-
// src/explicit-resource-management-polyfill.ts
|
|
603
|
-
Symbol.dispose ??= Symbol("Symbol.dispose");
|
|
604
|
-
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
605
|
-
|
|
606
599
|
// src/defer.ts
|
|
607
600
|
var defer = (fn) => new DeferGuard(fn);
|
|
608
601
|
var DeferGuard = class {
|
|
@@ -664,33 +657,6 @@ var MapEntry = class {
|
|
|
664
657
|
}
|
|
665
658
|
};
|
|
666
659
|
|
|
667
|
-
// src/first-two-chars.ts
|
|
668
|
-
var renderableCharRegex = /^(?![\p{Control}\p{Mark}\p{Separator}\p{Surrogate}\p{Unassigned}\p{P}])[\p{L}\p{N}\p{S}\p{Emoji}]$/u;
|
|
669
|
-
var getFirstTwoRenderableChars = (label) => {
|
|
670
|
-
const characters = Array.from(label);
|
|
671
|
-
const result = [
|
|
672
|
-
"",
|
|
673
|
-
""
|
|
674
|
-
];
|
|
675
|
-
let foundFirst = false;
|
|
676
|
-
for (let i = 0; i < characters.length; i++) {
|
|
677
|
-
const char = characters[i];
|
|
678
|
-
if (renderableCharRegex.test(char)) {
|
|
679
|
-
if (!foundFirst) {
|
|
680
|
-
result[0] = char;
|
|
681
|
-
foundFirst = true;
|
|
682
|
-
} else {
|
|
683
|
-
const textBetween = characters.slice(result[0].length, i).join("");
|
|
684
|
-
if (/[^\p{L}\p{N}_]/u.test(textBetween)) {
|
|
685
|
-
result[1] = char;
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
return result;
|
|
692
|
-
};
|
|
693
|
-
|
|
694
660
|
// src/for-each-async.ts
|
|
695
661
|
var forEachAsync = (items, fn) => Promise.all(items.map(fn));
|
|
696
662
|
|
|
@@ -1222,32 +1188,9 @@ var deepMapValues = (value, fn) => {
|
|
|
1222
1188
|
};
|
|
1223
1189
|
var DeepMapper = class {
|
|
1224
1190
|
_fn;
|
|
1225
|
-
_cyclic;
|
|
1191
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1226
1192
|
constructor(_fn) {
|
|
1227
1193
|
this._fn = _fn;
|
|
1228
|
-
this._cyclic = /* @__PURE__ */ new Map();
|
|
1229
|
-
this._recurse = (value) => {
|
|
1230
|
-
if (this._cyclic.has(value)) {
|
|
1231
|
-
return this._cyclic.get(value);
|
|
1232
|
-
}
|
|
1233
|
-
if (Array.isArray(value)) {
|
|
1234
|
-
const res = new Array(value.length);
|
|
1235
|
-
this._cyclic.set(value, res);
|
|
1236
|
-
for (let i = 0; i < value.length; i++) {
|
|
1237
|
-
res[i] = this._map(value[i], i);
|
|
1238
|
-
}
|
|
1239
|
-
return res;
|
|
1240
|
-
} else if (value !== null && typeof value === "object") {
|
|
1241
|
-
const res = {};
|
|
1242
|
-
this._cyclic.set(value, res);
|
|
1243
|
-
for (const key in value) {
|
|
1244
|
-
res[key] = this._map(value[key], key);
|
|
1245
|
-
}
|
|
1246
|
-
return res;
|
|
1247
|
-
} else {
|
|
1248
|
-
return value;
|
|
1249
|
-
}
|
|
1250
|
-
};
|
|
1251
1194
|
}
|
|
1252
1195
|
map(value) {
|
|
1253
1196
|
return this._map(value, void 0);
|
|
@@ -1258,39 +1201,37 @@ var DeepMapper = class {
|
|
|
1258
1201
|
}
|
|
1259
1202
|
return this._fn(value, this._recurse, key);
|
|
1260
1203
|
}
|
|
1261
|
-
_recurse
|
|
1204
|
+
_recurse = (value) => {
|
|
1205
|
+
if (this._cyclic.has(value)) {
|
|
1206
|
+
return this._cyclic.get(value);
|
|
1207
|
+
}
|
|
1208
|
+
if (Array.isArray(value)) {
|
|
1209
|
+
const res = new Array(value.length);
|
|
1210
|
+
this._cyclic.set(value, res);
|
|
1211
|
+
for (let i = 0; i < value.length; i++) {
|
|
1212
|
+
res[i] = this._map(value[i], i);
|
|
1213
|
+
}
|
|
1214
|
+
return res;
|
|
1215
|
+
} else if (value !== null && typeof value === "object") {
|
|
1216
|
+
const res = {};
|
|
1217
|
+
this._cyclic.set(value, res);
|
|
1218
|
+
for (const key in value) {
|
|
1219
|
+
res[key] = this._map(value[key], key);
|
|
1220
|
+
}
|
|
1221
|
+
return res;
|
|
1222
|
+
} else {
|
|
1223
|
+
return value;
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1262
1226
|
};
|
|
1263
1227
|
var deepMapValuesAsync = (value, fn) => {
|
|
1264
1228
|
return new DeepMapperAsync(fn).map(value);
|
|
1265
1229
|
};
|
|
1266
1230
|
var DeepMapperAsync = class {
|
|
1267
1231
|
_fn;
|
|
1268
|
-
_cyclic;
|
|
1232
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1269
1233
|
constructor(_fn) {
|
|
1270
1234
|
this._fn = _fn;
|
|
1271
|
-
this._cyclic = /* @__PURE__ */ new Map();
|
|
1272
|
-
this._recurse = async (value) => {
|
|
1273
|
-
if (this._cyclic.has(value)) {
|
|
1274
|
-
return this._cyclic.get(value);
|
|
1275
|
-
}
|
|
1276
|
-
if (Array.isArray(value)) {
|
|
1277
|
-
const res = new Array(value.length);
|
|
1278
|
-
this._cyclic.set(value, res);
|
|
1279
|
-
for (let i = 0; i < value.length; i++) {
|
|
1280
|
-
res[i] = await this._map(value[i], i);
|
|
1281
|
-
}
|
|
1282
|
-
return res;
|
|
1283
|
-
} else if (value !== null && typeof value === "object") {
|
|
1284
|
-
const res = {};
|
|
1285
|
-
this._cyclic.set(value, res);
|
|
1286
|
-
for (const key in value) {
|
|
1287
|
-
res[key] = await this._map(value[key], key);
|
|
1288
|
-
}
|
|
1289
|
-
return res;
|
|
1290
|
-
} else {
|
|
1291
|
-
return value;
|
|
1292
|
-
}
|
|
1293
|
-
};
|
|
1294
1235
|
}
|
|
1295
1236
|
map(value) {
|
|
1296
1237
|
return this._map(value, void 0);
|
|
@@ -1301,7 +1242,28 @@ var DeepMapperAsync = class {
|
|
|
1301
1242
|
}
|
|
1302
1243
|
return this._fn(value, this._recurse, key);
|
|
1303
1244
|
}
|
|
1304
|
-
_recurse
|
|
1245
|
+
_recurse = async (value) => {
|
|
1246
|
+
if (this._cyclic.has(value)) {
|
|
1247
|
+
return this._cyclic.get(value);
|
|
1248
|
+
}
|
|
1249
|
+
if (Array.isArray(value)) {
|
|
1250
|
+
const res = new Array(value.length);
|
|
1251
|
+
this._cyclic.set(value, res);
|
|
1252
|
+
for (let i = 0; i < value.length; i++) {
|
|
1253
|
+
res[i] = await this._map(value[i], i);
|
|
1254
|
+
}
|
|
1255
|
+
return res;
|
|
1256
|
+
} else if (value !== null && typeof value === "object") {
|
|
1257
|
+
const res = {};
|
|
1258
|
+
this._cyclic.set(value, res);
|
|
1259
|
+
for (const key in value) {
|
|
1260
|
+
res[key] = await this._map(value[key], key);
|
|
1261
|
+
}
|
|
1262
|
+
return res;
|
|
1263
|
+
} else {
|
|
1264
|
+
return value;
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1305
1267
|
};
|
|
1306
1268
|
var visitValues = (object, visitor) => {
|
|
1307
1269
|
if (Array.isArray(object)) {
|
|
@@ -1623,7 +1585,7 @@ var safeParseInt = (value, defaultValue) => {
|
|
|
1623
1585
|
try {
|
|
1624
1586
|
const n = parseInt(value ?? "");
|
|
1625
1587
|
return isNaN(n) ? defaultValue : n;
|
|
1626
|
-
} catch
|
|
1588
|
+
} catch {
|
|
1627
1589
|
return defaultValue;
|
|
1628
1590
|
}
|
|
1629
1591
|
};
|
|
@@ -1638,12 +1600,79 @@ var safeParseJson = (data, defaultValue) => {
|
|
|
1638
1600
|
if (data && data.length > 0) {
|
|
1639
1601
|
try {
|
|
1640
1602
|
return JSON.parse(data);
|
|
1641
|
-
} catch
|
|
1603
|
+
} catch {
|
|
1642
1604
|
}
|
|
1643
1605
|
}
|
|
1644
1606
|
return defaultValue;
|
|
1645
1607
|
};
|
|
1646
1608
|
|
|
1609
|
+
// src/safe-stringify.ts
|
|
1610
|
+
var SKIP = Object.freeze({});
|
|
1611
|
+
function safeStringify(obj, filter = defaultFilter, indent = 2) {
|
|
1612
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
1613
|
+
function replacer(key, value) {
|
|
1614
|
+
if (typeof value === "object" && value !== null) {
|
|
1615
|
+
if (seen.has(value)) {
|
|
1616
|
+
return "[Circular]";
|
|
1617
|
+
}
|
|
1618
|
+
seen.add(value);
|
|
1619
|
+
}
|
|
1620
|
+
if (filter) {
|
|
1621
|
+
const v2 = filter?.(key, value);
|
|
1622
|
+
if (v2 !== void 0) {
|
|
1623
|
+
return v2 === SKIP ? void 0 : v2;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
return value;
|
|
1627
|
+
}
|
|
1628
|
+
let result = "";
|
|
1629
|
+
try {
|
|
1630
|
+
result = JSON.stringify(obj, replacer, indent);
|
|
1631
|
+
} catch (error) {
|
|
1632
|
+
result = `Error: ${error.message}`;
|
|
1633
|
+
}
|
|
1634
|
+
return result;
|
|
1635
|
+
}
|
|
1636
|
+
var createReplacer = ({ omit: omit2, parse, maxDepth, maxArrayLen, maxStringLen } = {}) => {
|
|
1637
|
+
let currentDepth = 0;
|
|
1638
|
+
const depthMap = /* @__PURE__ */ new WeakMap();
|
|
1639
|
+
return function(key, value) {
|
|
1640
|
+
if (key === "") {
|
|
1641
|
+
currentDepth = 0;
|
|
1642
|
+
} else if (this && typeof this === "object") {
|
|
1643
|
+
const parentDepth = depthMap.get(this) ?? 0;
|
|
1644
|
+
currentDepth = parentDepth + 1;
|
|
1645
|
+
}
|
|
1646
|
+
if (typeof value === "function") {
|
|
1647
|
+
return void 0;
|
|
1648
|
+
}
|
|
1649
|
+
if (value && typeof value === "object") {
|
|
1650
|
+
depthMap.set(value, currentDepth);
|
|
1651
|
+
if (maxDepth != null && currentDepth >= maxDepth) {
|
|
1652
|
+
return Array.isArray(value) ? `[{ length: ${value.length} }]` : `{ keys: ${Object.keys(value).length} }`;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
if (omit2?.includes(key)) {
|
|
1656
|
+
return void 0;
|
|
1657
|
+
}
|
|
1658
|
+
if (parse?.includes(key) && typeof value === "string") {
|
|
1659
|
+
try {
|
|
1660
|
+
return JSON.parse(value);
|
|
1661
|
+
} catch {
|
|
1662
|
+
return value;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
if (maxArrayLen != null && Array.isArray(value) && value.length > maxArrayLen) {
|
|
1666
|
+
return `[length: ${value.length}]`;
|
|
1667
|
+
}
|
|
1668
|
+
if (maxStringLen != null && typeof value === "string" && value.length > maxStringLen) {
|
|
1669
|
+
return value.slice(0, maxStringLen) + "...";
|
|
1670
|
+
}
|
|
1671
|
+
return value;
|
|
1672
|
+
};
|
|
1673
|
+
};
|
|
1674
|
+
var defaultFilter = createReplacer();
|
|
1675
|
+
|
|
1647
1676
|
// src/sliding-window-summary.ts
|
|
1648
1677
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1649
1678
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/common/util/src/sliding-window-summary.ts";
|
|
@@ -1748,6 +1777,7 @@ function trim(strings, ...values) {
|
|
|
1748
1777
|
const minIndent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^[ \t]*/)?.[0].length ?? 0));
|
|
1749
1778
|
return lines.map((l) => l.slice(minIndent)).join("\n");
|
|
1750
1779
|
}
|
|
1780
|
+
var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1751
1781
|
|
|
1752
1782
|
// src/sum.ts
|
|
1753
1783
|
var sum = (values) => values.reduce((a, b) => a + b, 0);
|
|
@@ -2048,7 +2078,7 @@ var stringifyTree = (node, ancestors = [], rows = []) => {
|
|
|
2048
2078
|
};
|
|
2049
2079
|
|
|
2050
2080
|
// src/types.ts
|
|
2051
|
-
var
|
|
2081
|
+
var isTruthy = (value) => !!value;
|
|
2052
2082
|
var isNonNullable = (value) => value != null;
|
|
2053
2083
|
var doAsync = async (fn) => fn();
|
|
2054
2084
|
var getProviderValue = (provider, arg) => {
|
|
@@ -2079,6 +2109,103 @@ var arrayMove = (array, from, to) => {
|
|
|
2079
2109
|
return array;
|
|
2080
2110
|
};
|
|
2081
2111
|
|
|
2112
|
+
// src/unit.ts
|
|
2113
|
+
var createFormat = (unit) => {
|
|
2114
|
+
return (n, precision = unit.precision ?? 0) => {
|
|
2115
|
+
const value = n / unit.quotient;
|
|
2116
|
+
return {
|
|
2117
|
+
unit,
|
|
2118
|
+
value,
|
|
2119
|
+
formattedValue: value.toFixed(precision),
|
|
2120
|
+
toString: () => `${value.toFixed(precision)}${unit.symbol}`
|
|
2121
|
+
};
|
|
2122
|
+
};
|
|
2123
|
+
};
|
|
2124
|
+
var MS_SECONDS = 1e3;
|
|
2125
|
+
var MS_MINUTES = 60 * MS_SECONDS;
|
|
2126
|
+
var MS_HOURS = 60 * MS_MINUTES;
|
|
2127
|
+
var Unit = {
|
|
2128
|
+
// General.
|
|
2129
|
+
Percent: createFormat({
|
|
2130
|
+
symbol: "%",
|
|
2131
|
+
quotient: 1 / 100,
|
|
2132
|
+
precision: 2
|
|
2133
|
+
}),
|
|
2134
|
+
Thousand: createFormat({
|
|
2135
|
+
symbol: "k",
|
|
2136
|
+
quotient: 1e3,
|
|
2137
|
+
precision: 2
|
|
2138
|
+
}),
|
|
2139
|
+
// Bytes (note KB vs KiB).
|
|
2140
|
+
Gigabyte: createFormat({
|
|
2141
|
+
symbol: "GB",
|
|
2142
|
+
quotient: 1e3 * 1e3 * 1e3,
|
|
2143
|
+
precision: 2
|
|
2144
|
+
}),
|
|
2145
|
+
Megabyte: createFormat({
|
|
2146
|
+
symbol: "MB",
|
|
2147
|
+
quotient: 1e3 * 1e3,
|
|
2148
|
+
precision: 2
|
|
2149
|
+
}),
|
|
2150
|
+
Kilobyte: createFormat({
|
|
2151
|
+
symbol: "KB",
|
|
2152
|
+
quotient: 1e3,
|
|
2153
|
+
precision: 2
|
|
2154
|
+
}),
|
|
2155
|
+
// Time.
|
|
2156
|
+
Hour: createFormat({
|
|
2157
|
+
symbol: "h",
|
|
2158
|
+
quotient: MS_HOURS
|
|
2159
|
+
}),
|
|
2160
|
+
Minute: createFormat({
|
|
2161
|
+
symbol: "m",
|
|
2162
|
+
quotient: MS_MINUTES
|
|
2163
|
+
}),
|
|
2164
|
+
Second: createFormat({
|
|
2165
|
+
symbol: "s",
|
|
2166
|
+
quotient: MS_SECONDS,
|
|
2167
|
+
precision: 1
|
|
2168
|
+
}),
|
|
2169
|
+
Millisecond: createFormat({
|
|
2170
|
+
symbol: "ms",
|
|
2171
|
+
quotient: 1
|
|
2172
|
+
}),
|
|
2173
|
+
Duration: (n) => {
|
|
2174
|
+
const hours = Math.floor(n / MS_HOURS);
|
|
2175
|
+
const minutes = Math.floor(n % MS_HOURS / MS_MINUTES);
|
|
2176
|
+
if (hours) {
|
|
2177
|
+
const formattedValue = minutes ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
2178
|
+
return {
|
|
2179
|
+
unit: {
|
|
2180
|
+
symbol: "h",
|
|
2181
|
+
quotient: MS_HOURS
|
|
2182
|
+
},
|
|
2183
|
+
value: hours,
|
|
2184
|
+
formattedValue,
|
|
2185
|
+
toString: () => formattedValue
|
|
2186
|
+
};
|
|
2187
|
+
}
|
|
2188
|
+
if (minutes) {
|
|
2189
|
+
const seconds2 = (n - MS_MINUTES * minutes) / MS_SECONDS;
|
|
2190
|
+
const formattedValue = seconds2 ? `${minutes}m ${seconds2}s` : `${minutes}m`;
|
|
2191
|
+
return {
|
|
2192
|
+
unit: {
|
|
2193
|
+
symbol: "m",
|
|
2194
|
+
quotient: MS_MINUTES
|
|
2195
|
+
},
|
|
2196
|
+
value: minutes,
|
|
2197
|
+
formattedValue,
|
|
2198
|
+
toString: () => formattedValue
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
const seconds = n >= MS_SECONDS;
|
|
2202
|
+
if (seconds) {
|
|
2203
|
+
return Unit.Second(n);
|
|
2204
|
+
}
|
|
2205
|
+
return Unit.Millisecond(n);
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2082
2209
|
// src/url.ts
|
|
2083
2210
|
var createUrl = (url, search) => {
|
|
2084
2211
|
const base = typeof url === "string" ? new URL(url) : url;
|
|
@@ -2191,8 +2318,10 @@ export {
|
|
|
2191
2318
|
ComplexSet,
|
|
2192
2319
|
HumanHasher,
|
|
2193
2320
|
MapEntry,
|
|
2321
|
+
SKIP,
|
|
2194
2322
|
SlidingWindowSummary,
|
|
2195
2323
|
Tracer,
|
|
2324
|
+
Unit,
|
|
2196
2325
|
WeakDictionary,
|
|
2197
2326
|
accessBy,
|
|
2198
2327
|
arrayMove,
|
|
@@ -2214,11 +2343,13 @@ export {
|
|
|
2214
2343
|
createBinder,
|
|
2215
2344
|
createBucketReducer,
|
|
2216
2345
|
createGroupReducer,
|
|
2346
|
+
createReplacer,
|
|
2217
2347
|
createSetDispatch,
|
|
2218
2348
|
createUrl,
|
|
2219
2349
|
decamelize,
|
|
2220
2350
|
deepMapValues,
|
|
2221
2351
|
deepMapValuesAsync,
|
|
2352
|
+
defaultFilter,
|
|
2222
2353
|
defaultMap,
|
|
2223
2354
|
defer,
|
|
2224
2355
|
deferAsync,
|
|
@@ -2235,7 +2366,6 @@ export {
|
|
|
2235
2366
|
getDate,
|
|
2236
2367
|
getDebugName,
|
|
2237
2368
|
getDeep,
|
|
2238
|
-
getFirstTwoRenderableChars,
|
|
2239
2369
|
getHostPlatform,
|
|
2240
2370
|
getPrototypeSpecificInstanceId,
|
|
2241
2371
|
getProviderValue,
|
|
@@ -2253,12 +2383,13 @@ export {
|
|
|
2253
2383
|
iosCheck,
|
|
2254
2384
|
isNode,
|
|
2255
2385
|
isNonNullable,
|
|
2256
|
-
|
|
2386
|
+
isTruthy,
|
|
2257
2387
|
joinTables,
|
|
2258
2388
|
jsonKeyReplacer,
|
|
2259
2389
|
jsonReplacer,
|
|
2260
2390
|
jsonify,
|
|
2261
2391
|
jsonlogify,
|
|
2392
|
+
kebabize,
|
|
2262
2393
|
keyToEmoji,
|
|
2263
2394
|
keyToFallback,
|
|
2264
2395
|
keyToHue,
|
|
@@ -2289,6 +2420,7 @@ export {
|
|
|
2289
2420
|
safeParseFloat,
|
|
2290
2421
|
safeParseInt,
|
|
2291
2422
|
safeParseJson,
|
|
2423
|
+
safeStringify,
|
|
2292
2424
|
set,
|
|
2293
2425
|
setDeep,
|
|
2294
2426
|
sortKeys,
|