rubico 2.0.1 → 2.2.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/README.md +10 -8
- package/Transducer.js +28 -0
- package/_internal/genericTransform.js +30 -28
- package/_internal/reducerTryCatch.js +55 -0
- package/dist/Transducer.es.js +28 -1
- package/dist/Transducer.es.min.js +2 -2
- package/dist/Transducer.js +28 -1
- package/dist/Transducer.min.js +2 -2
- package/dist/Transducer.mjs +28 -1
- package/dist/__.es.js +1 -1
- package/dist/__.es.min.js +1 -1
- package/dist/__.js +1 -1
- package/dist/__.min.js +1 -1
- package/dist/__.mjs +1 -1
- package/dist/all.es.js +1 -1
- package/dist/all.es.min.js +1 -1
- package/dist/all.js +1 -1
- package/dist/all.min.js +1 -1
- package/dist/all.mjs +1 -1
- package/dist/always.es.js +1 -1
- package/dist/always.es.min.js +1 -1
- package/dist/always.js +1 -1
- package/dist/always.min.js +1 -1
- package/dist/always.mjs +1 -1
- package/dist/and.es.js +1 -1
- package/dist/and.es.min.js +1 -1
- package/dist/and.js +1 -1
- package/dist/and.min.js +1 -1
- package/dist/and.mjs +1 -1
- package/dist/assign.es.js +1 -1
- package/dist/assign.es.min.js +1 -1
- package/dist/assign.js +1 -1
- package/dist/assign.min.js +1 -1
- package/dist/assign.mjs +1 -1
- package/dist/compose.es.js +1 -1
- package/dist/compose.es.min.js +1 -1
- package/dist/compose.js +1 -1
- package/dist/compose.min.js +1 -1
- package/dist/compose.mjs +1 -1
- package/dist/curry.es.js +1 -1
- package/dist/curry.es.min.js +1 -1
- package/dist/curry.js +1 -1
- package/dist/curry.min.js +1 -1
- package/dist/curry.mjs +1 -1
- package/dist/eq.es.js +1 -1
- package/dist/eq.es.min.js +1 -1
- package/dist/eq.js +1 -1
- package/dist/eq.min.js +1 -1
- package/dist/eq.mjs +1 -1
- package/dist/every.es.js +1 -1
- package/dist/every.es.min.js +1 -1
- package/dist/every.js +1 -1
- package/dist/every.min.js +1 -1
- package/dist/every.mjs +1 -1
- package/dist/filter.es.js +1 -1
- package/dist/filter.es.min.js +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.min.js +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/flatMap.es.js +1 -1
- package/dist/flatMap.es.min.js +1 -1
- package/dist/flatMap.js +1 -1
- package/dist/flatMap.min.js +1 -1
- package/dist/flatMap.mjs +1 -1
- package/dist/forEach.es.js +1 -1
- package/dist/forEach.es.min.js +1 -1
- package/dist/forEach.js +1 -1
- package/dist/forEach.min.js +1 -1
- package/dist/forEach.mjs +1 -1
- package/dist/get.es.js +1 -1
- package/dist/get.es.min.js +1 -1
- package/dist/get.js +1 -1
- package/dist/get.min.js +1 -1
- package/dist/get.mjs +1 -1
- package/dist/gt.es.js +1 -1
- package/dist/gt.es.min.js +1 -1
- package/dist/gt.js +1 -1
- package/dist/gt.min.js +1 -1
- package/dist/gt.mjs +1 -1
- package/dist/gte.es.js +1 -1
- package/dist/gte.es.min.js +1 -1
- package/dist/gte.js +1 -1
- package/dist/gte.min.js +1 -1
- package/dist/gte.mjs +1 -1
- package/dist/lt.es.js +1 -1
- package/dist/lt.es.min.js +1 -1
- package/dist/lt.js +1 -1
- package/dist/lt.min.js +1 -1
- package/dist/lt.mjs +1 -1
- package/dist/lte.es.js +1 -1
- package/dist/lte.es.min.js +1 -1
- package/dist/lte.js +1 -1
- package/dist/lte.min.js +1 -1
- package/dist/lte.mjs +1 -1
- package/dist/map.es.js +1 -1
- package/dist/map.es.min.js +1 -1
- package/dist/map.js +1 -1
- package/dist/map.min.js +1 -1
- package/dist/map.mjs +1 -1
- package/dist/not.es.js +1 -1
- package/dist/not.es.min.js +1 -1
- package/dist/not.js +1 -1
- package/dist/not.min.js +1 -1
- package/dist/not.mjs +1 -1
- package/dist/omit.es.js +1 -1
- package/dist/omit.es.min.js +1 -1
- package/dist/omit.js +1 -1
- package/dist/omit.min.js +1 -1
- package/dist/omit.mjs +1 -1
- package/dist/or.es.js +1 -1
- package/dist/or.es.min.js +1 -1
- package/dist/or.js +1 -1
- package/dist/or.min.js +1 -1
- package/dist/or.mjs +1 -1
- package/dist/pick.es.js +1 -1
- package/dist/pick.es.min.js +1 -1
- package/dist/pick.js +1 -1
- package/dist/pick.min.js +1 -1
- package/dist/pick.mjs +1 -1
- package/dist/pipe.es.js +1 -1
- package/dist/pipe.es.min.js +1 -1
- package/dist/pipe.js +1 -1
- package/dist/pipe.min.js +1 -1
- package/dist/pipe.mjs +1 -1
- package/dist/reduce.es.js +1 -1
- package/dist/reduce.es.min.js +1 -1
- package/dist/reduce.js +1 -1
- package/dist/reduce.min.js +1 -1
- package/dist/reduce.mjs +1 -1
- package/dist/rubico.es.js +57 -46
- package/dist/rubico.es.min.js +2 -2
- package/dist/rubico.global.js +57 -46
- package/dist/rubico.global.min.js +2 -2
- package/dist/rubico.js +57 -46
- package/dist/rubico.min.js +2 -2
- package/dist/rubico.mjs +57 -46
- package/dist/set.es.js +1 -1
- package/dist/set.es.min.js +1 -1
- package/dist/set.js +1 -1
- package/dist/set.min.js +1 -1
- package/dist/set.mjs +1 -1
- package/dist/some.es.js +1 -1
- package/dist/some.es.min.js +1 -1
- package/dist/some.js +1 -1
- package/dist/some.min.js +1 -1
- package/dist/some.mjs +1 -1
- package/dist/switchCase.es.js +1 -1
- package/dist/switchCase.es.min.js +1 -1
- package/dist/switchCase.js +1 -1
- package/dist/switchCase.min.js +1 -1
- package/dist/switchCase.mjs +1 -1
- package/dist/tap.es.js +32 -2
- package/dist/tap.es.min.js +2 -2
- package/dist/tap.js +32 -2
- package/dist/tap.min.js +2 -2
- package/dist/tap.mjs +32 -2
- package/dist/thunkify.es.js +1 -1
- package/dist/thunkify.es.min.js +1 -1
- package/dist/thunkify.js +1 -1
- package/dist/thunkify.min.js +1 -1
- package/dist/thunkify.mjs +1 -1
- package/dist/transform.es.js +26 -24
- package/dist/transform.es.min.js +2 -2
- package/dist/transform.js +26 -24
- package/dist/transform.min.js +2 -2
- package/dist/transform.mjs +26 -24
- package/dist/tryCatch.es.js +1 -1
- package/dist/tryCatch.es.min.js +1 -1
- package/dist/tryCatch.js +1 -1
- package/dist/tryCatch.min.js +1 -1
- package/dist/tryCatch.mjs +1 -1
- package/dist/x/append.es.js +1 -1
- package/dist/x/append.es.min.js +1 -1
- package/dist/x/append.js +1 -1
- package/dist/x/append.min.js +1 -1
- package/dist/x/append.mjs +1 -1
- package/dist/x/callProp.es.js +1 -1
- package/dist/x/callProp.es.min.js +1 -1
- package/dist/x/callProp.js +1 -1
- package/dist/x/callProp.min.js +1 -1
- package/dist/x/callProp.mjs +1 -1
- package/dist/x/defaultsDeep.es.js +1 -1
- package/dist/x/defaultsDeep.es.min.js +1 -1
- package/dist/x/defaultsDeep.js +1 -1
- package/dist/x/defaultsDeep.min.js +1 -1
- package/dist/x/defaultsDeep.mjs +1 -1
- package/dist/x/differenceWith.es.js +1 -1
- package/dist/x/differenceWith.es.min.js +1 -1
- package/dist/x/differenceWith.js +1 -1
- package/dist/x/differenceWith.min.js +1 -1
- package/dist/x/differenceWith.mjs +1 -1
- package/dist/x/filterOut.es.js +1 -1
- package/dist/x/filterOut.es.min.js +1 -1
- package/dist/x/filterOut.js +1 -1
- package/dist/x/filterOut.min.js +1 -1
- package/dist/x/filterOut.mjs +1 -1
- package/dist/x/find.es.js +1 -1
- package/dist/x/find.es.min.js +1 -1
- package/dist/x/find.js +1 -1
- package/dist/x/find.min.js +1 -1
- package/dist/x/find.mjs +1 -1
- package/dist/x/findIndex.es.js +1 -1
- package/dist/x/findIndex.es.min.js +1 -1
- package/dist/x/findIndex.js +1 -1
- package/dist/x/findIndex.min.js +1 -1
- package/dist/x/findIndex.mjs +1 -1
- package/dist/x/first.es.js +1 -1
- package/dist/x/first.es.min.js +1 -1
- package/dist/x/first.js +1 -1
- package/dist/x/first.min.js +1 -1
- package/dist/x/first.mjs +1 -1
- package/dist/x/flatten.es.js +1 -1
- package/dist/x/flatten.es.min.js +1 -1
- package/dist/x/flatten.js +1 -1
- package/dist/x/flatten.min.js +1 -1
- package/dist/x/flatten.mjs +1 -1
- package/dist/x/groupBy.es.js +1 -1
- package/dist/x/groupBy.es.min.js +1 -1
- package/dist/x/groupBy.js +1 -1
- package/dist/x/groupBy.min.js +1 -1
- package/dist/x/groupBy.mjs +1 -1
- package/dist/x/has.es.js +1 -1
- package/dist/x/has.es.min.js +1 -1
- package/dist/x/has.js +1 -1
- package/dist/x/has.min.js +1 -1
- package/dist/x/has.mjs +1 -1
- package/dist/x/identity.es.js +1 -1
- package/dist/x/identity.es.min.js +1 -1
- package/dist/x/identity.js +1 -1
- package/dist/x/identity.min.js +1 -1
- package/dist/x/identity.mjs +1 -1
- package/dist/x/includes.es.js +1 -1
- package/dist/x/includes.es.min.js +1 -1
- package/dist/x/includes.js +1 -1
- package/dist/x/includes.min.js +1 -1
- package/dist/x/includes.mjs +1 -1
- package/dist/x/isDeepEqual.es.js +1 -1
- package/dist/x/isDeepEqual.es.min.js +1 -1
- package/dist/x/isDeepEqual.js +1 -1
- package/dist/x/isDeepEqual.min.js +1 -1
- package/dist/x/isDeepEqual.mjs +1 -1
- package/dist/x/isEmpty.es.js +1 -1
- package/dist/x/isEmpty.es.min.js +1 -1
- package/dist/x/isEmpty.js +1 -1
- package/dist/x/isEmpty.min.js +1 -1
- package/dist/x/isEmpty.mjs +1 -1
- package/dist/x/isEqual.es.js +1 -1
- package/dist/x/isEqual.es.min.js +1 -1
- package/dist/x/isEqual.js +1 -1
- package/dist/x/isEqual.min.js +1 -1
- package/dist/x/isEqual.mjs +1 -1
- package/dist/x/isFunction.es.js +1 -1
- package/dist/x/isFunction.es.min.js +1 -1
- package/dist/x/isFunction.js +1 -1
- package/dist/x/isFunction.min.js +1 -1
- package/dist/x/isFunction.mjs +1 -1
- package/dist/x/isIn.es.js +1 -1
- package/dist/x/isIn.es.min.js +1 -1
- package/dist/x/isIn.js +1 -1
- package/dist/x/isIn.min.js +1 -1
- package/dist/x/isIn.mjs +1 -1
- package/dist/x/isObject.es.js +1 -1
- package/dist/x/isObject.es.min.js +1 -1
- package/dist/x/isObject.js +1 -1
- package/dist/x/isObject.min.js +1 -1
- package/dist/x/isObject.mjs +1 -1
- package/dist/x/isString.es.js +1 -1
- package/dist/x/isString.es.min.js +1 -1
- package/dist/x/isString.js +1 -1
- package/dist/x/isString.min.js +1 -1
- package/dist/x/isString.mjs +1 -1
- package/dist/x/keys.es.js +1 -1
- package/dist/x/keys.es.min.js +1 -1
- package/dist/x/keys.js +1 -1
- package/dist/x/keys.min.js +1 -1
- package/dist/x/keys.mjs +1 -1
- package/dist/x/last.es.js +1 -1
- package/dist/x/last.es.min.js +1 -1
- package/dist/x/last.js +1 -1
- package/dist/x/last.min.js +1 -1
- package/dist/x/last.mjs +1 -1
- package/dist/x/maxBy.es.js +1 -1
- package/dist/x/maxBy.es.min.js +1 -1
- package/dist/x/maxBy.js +1 -1
- package/dist/x/maxBy.min.js +1 -1
- package/dist/x/maxBy.mjs +1 -1
- package/dist/x/noop.es.js +1 -1
- package/dist/x/noop.es.min.js +1 -1
- package/dist/x/noop.js +1 -1
- package/dist/x/noop.min.js +1 -1
- package/dist/x/noop.mjs +1 -1
- package/dist/x/pluck.es.js +1 -1
- package/dist/x/pluck.es.min.js +1 -1
- package/dist/x/pluck.js +1 -1
- package/dist/x/pluck.min.js +1 -1
- package/dist/x/pluck.mjs +1 -1
- package/dist/x/prepend.es.js +1 -1
- package/dist/x/prepend.es.min.js +1 -1
- package/dist/x/prepend.js +1 -1
- package/dist/x/prepend.min.js +1 -1
- package/dist/x/prepend.mjs +1 -1
- package/dist/x/size.es.js +1 -1
- package/dist/x/size.es.min.js +1 -1
- package/dist/x/size.js +1 -1
- package/dist/x/size.min.js +1 -1
- package/dist/x/size.mjs +1 -1
- package/dist/x/trace.es.js +32 -2
- package/dist/x/trace.es.min.js +2 -2
- package/dist/x/trace.js +32 -2
- package/dist/x/trace.min.js +2 -2
- package/dist/x/trace.mjs +32 -2
- package/dist/x/unionWith.es.js +1 -1
- package/dist/x/unionWith.es.min.js +1 -1
- package/dist/x/unionWith.js +1 -1
- package/dist/x/unionWith.min.js +1 -1
- package/dist/x/unionWith.mjs +1 -1
- package/dist/x/uniq.es.js +1 -1
- package/dist/x/uniq.es.min.js +1 -1
- package/dist/x/uniq.js +1 -1
- package/dist/x/uniq.min.js +1 -1
- package/dist/x/uniq.mjs +1 -1
- package/dist/x/unless.es.js +1 -1
- package/dist/x/unless.es.min.js +1 -1
- package/dist/x/unless.js +1 -1
- package/dist/x/unless.min.js +1 -1
- package/dist/x/unless.mjs +1 -1
- package/dist/x/values.es.js +1 -1
- package/dist/x/values.es.min.js +1 -1
- package/dist/x/values.js +1 -1
- package/dist/x/values.min.js +1 -1
- package/dist/x/values.mjs +1 -1
- package/dist/x/when.es.js +1 -1
- package/dist/x/when.es.min.js +1 -1
- package/dist/x/when.js +1 -1
- package/dist/x/when.min.js +1 -1
- package/dist/x/when.mjs +1 -1
- package/es.js +57 -46
- package/index.js +57 -46
- package/package.json +43 -2
- package/tap.js +15 -4
- package/.eslintignore +0 -5
- package/.eslintrc.js +0 -330
- package/.github/workflows/nodejs.yml +0 -27
- package/.vscode/launch.json +0 -25
- package/AggregateReducer.test.js +0 -82
- package/CHANGELOG.md +0 -310
- package/CNAME +0 -1
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -4
- package/Transducer.test.js +0 -117
- package/_config.yml +0 -1
- package/_internal/improvedGenericTransform.js +0 -93
- package/archive/FlatMappingIterator-2020-09-28.js +0 -68
- package/archive/_Promise-2023-05-29.js +0 -93
- package/archive/arrayMap2-2023-05-29.js +0 -73
- package/archive/benchmarks-v1.9.7/all.js +0 -34
- package/archive/benchmarks-v1.9.7/and.js +0 -24
- package/archive/benchmarks-v1.9.7/any.js +0 -32
- package/archive/benchmarks-v1.9.7/assign.js +0 -174
- package/archive/benchmarks-v1.9.7/curry.js +0 -55
- package/archive/benchmarks-v1.9.7/eq.js +0 -25
- package/archive/benchmarks-v1.9.7/filter.js +0 -1322
- package/archive/benchmarks-v1.9.7/flatMap.js +0 -48
- package/archive/benchmarks-v1.9.7/forEach.js +0 -33
- package/archive/benchmarks-v1.9.7/fork.js +0 -123
- package/archive/benchmarks-v1.9.7/get.js +0 -44
- package/archive/benchmarks-v1.9.7/gt.js +0 -25
- package/archive/benchmarks-v1.9.7/gte.js +0 -25
- package/archive/benchmarks-v1.9.7/integration.js +0 -88
- package/archive/benchmarks-v1.9.7/lt.js +0 -25
- package/archive/benchmarks-v1.9.7/lte.js +0 -25
- package/archive/benchmarks-v1.9.7/map.js +0 -892
- package/archive/benchmarks-v1.9.7/misc.js +0 -470
- package/archive/benchmarks-v1.9.7/omit.js +0 -28
- package/archive/benchmarks-v1.9.7/or.js +0 -51
- package/archive/benchmarks-v1.9.7/pick.js +0 -24
- package/archive/benchmarks-v1.9.7/pipe.js +0 -152
- package/archive/benchmarks-v1.9.7/reduce.js +0 -739
- package/archive/benchmarks-v1.9.7/switchCase.js +0 -256
- package/archive/benchmarks-v1.9.7/tap.js +0 -90
- package/archive/benchmarks-v1.9.7/transform.js +0 -218
- package/archive/benchmarks-v1.9.7/tryCatch.js +0 -108
- package/archive/curry.js +0 -13
- package/archive/examples-v1.6.11/browserModule.html +0 -31
- package/archive/examples-v1.6.11/browserScript.html +0 -32
- package/archive/examples-v1.6.11/coolTransformToConsole.js +0 -1
- package/archive/examples-v1.6.11/denoLargeGasMap.js +0 -85
- package/archive/examples-v1.6.11/denoServer.js +0 -9
- package/archive/examples-v1.6.11/denoServerWithMiddleware.js +0 -55
- package/archive/examples-v1.6.11/logTodosRange.js +0 -21
- package/archive/examples-v1.6.11/makeARequest.html +0 -46
- package/archive/examples-v1.6.11/nodeComplexTransformation.js +0 -106
- package/archive/examples-v1.6.11/nodeConditionallyExtractIDs.js +0 -50
- package/archive/examples-v1.6.11/nodeFloatingPoint.js +0 -55
- package/archive/examples-v1.6.11/nodeGetAllJiraBoards.js +0 -45
- package/archive/examples-v1.6.11/nodeGetSocketIOClientsTotalCount.js +0 -34
- package/archive/examples-v1.6.11/nodeKafkaConsumer.js +0 -63
- package/archive/examples-v1.6.11/nodeMakeMultipleRequests.js +0 -55
- package/archive/examples-v1.6.11/nodeOnRecordAddTask.js +0 -34
- package/archive/examples-v1.6.11/nodePostRequestWithAuth.js +0 -36
- package/archive/examples-v1.6.11/nodeSpeedbackMatchmakingAlgorithm.js +0 -96
- package/archive/examples-v1.6.11/nodeTireData.js +0 -36
- package/archive/examples-v1.6.11/nodeTripleMap.js +0 -85
- package/archive/examples-v1.6.11/squaredOdds.ts +0 -16
- package/archive/examples-v1.6.11/transducerMaxBuyer.js +0 -67
- package/archive/examples-v1.6.11/transformLogTodosRange.js +0 -31
- package/archive/examples-v1.6.11/transformStreamRandomInts.js +0 -19
- package/archive/genericReduceConcurrent.js +0 -277
- package/archive/index.v0.2.9.js +0 -1685
- package/archive/objectValuesGenerator.js +0 -13
- package/archive/test.v0.2.9.js +0 -2334
- package/bench +0 -65
- package/benchmark-output/v1.9.7 +0 -268
- package/benchmarks/all.async.js +0 -43
- package/benchmarks/all.js +0 -43
- package/benchmarks/always.js +0 -15
- package/benchmarks/and.async.js +0 -25
- package/benchmarks/and.js +0 -25
- package/benchmarks/assign.async.js +0 -27
- package/benchmarks/assign.js +0 -27
- package/benchmarks/curry.js +0 -35
- package/benchmarks/eq.async.js +0 -23
- package/benchmarks/eq.js +0 -23
- package/benchmarks/every.async.js +0 -19
- package/benchmarks/every.js +0 -19
- package/benchmarks/filter.async.js +0 -32
- package/benchmarks/filter.js +0 -38
- package/benchmarks/flatMap.async.js +0 -26
- package/benchmarks/flatMap.js +0 -38
- package/benchmarks/get.async.js +0 -19
- package/benchmarks/get.js +0 -39
- package/benchmarks/gt.async.js +0 -23
- package/benchmarks/gt.js +0 -23
- package/benchmarks/gte.async.js +0 -23
- package/benchmarks/gte.js +0 -23
- package/benchmarks/lt.async.js +0 -23
- package/benchmarks/lt.js +0 -23
- package/benchmarks/lte.async.js +0 -23
- package/benchmarks/lte.js +0 -23
- package/benchmarks/map.async.js +0 -43
- package/benchmarks/map.js +0 -40
- package/benchmarks/misc/Promise.js +0 -26
- package/benchmarks/misc/isPromise.js +0 -30
- package/benchmarks/misc/promiseAll.js +0 -36
- package/benchmarks/not.js +0 -23
- package/benchmarks/omit.js +0 -38
- package/benchmarks/or.async.js +0 -25
- package/benchmarks/or.js +0 -25
- package/benchmarks/pick.js +0 -38
- package/benchmarks/pipe.async.js +0 -47
- package/benchmarks/pipe.js +0 -47
- package/benchmarks/reduce.async.js +0 -32
- package/benchmarks/reduce.js +0 -38
- package/benchmarks/set.async.js +0 -19
- package/benchmarks/set.js +0 -41
- package/benchmarks/some.async.js +0 -19
- package/benchmarks/some.js +0 -19
- package/benchmarks/switchCase.async.js +0 -27
- package/benchmarks/switchCase.js +0 -55
- package/benchmarks/tap.js +0 -15
- package/benchmarks/thunkify.js +0 -15
- package/benchmarks/transform.async.js +0 -27
- package/benchmarks/transform.js +0 -40
- package/benchmarks/tryCatch.async.js +0 -25
- package/benchmarks/tryCatch.js +0 -32
- package/build +0 -472
- package/dist-test.js +0 -37
- package/examples/type-to-search-wiki/README.md +0 -19
- package/examples/type-to-search-wiki/package.json +0 -13
- package/examples/type-to-search-wiki/src/app.js +0 -46
- package/examples/type-to-search-wiki/src/index.html +0 -18
- package/import-test.html +0 -73
- package/memory-usage/reduce.js +0 -40
- package/monad/AsyncPool.js +0 -0
- package/monad/BrokenPromise.js +0 -63
- package/monad/BrokenPromise.test.js +0 -22
- package/monad/Cancellable.js +0 -84
- package/monad/Cancellable.memoryUsage.js +0 -60
- package/monad/Cancellable.test.js +0 -20
- package/monad/Function.js +0 -0
- package/monad/Instance.benchmark.js +0 -378
- package/monad/Instance.js +0 -351
- package/monad/Instance.test.js +0 -445
- package/monad/Mux.benchmark.js +0 -29
- package/monad/Mux.js +0 -589
- package/monad/Mux.test.js +0 -512
- package/monad/PossiblePromise.benchmark.js +0 -87
- package/monad/PossiblePromise.js +0 -144
- package/monad/PossiblePromise.test.js +0 -89
- package/monad/README.md +0 -75
- package/monad/Reducer.js +0 -0
- package/monad/Sequence.benchmark.js +0 -42
- package/monad/Sequence.js +0 -36
- package/monad/SpecScript.js +0 -0
- package/monad/Stack.js +0 -0
- package/monad/Struct.benchmark.js +0 -154
- package/monad/Struct.js +0 -249
- package/monad/Struct.test.js +0 -237
- package/rubico.js +0 -66
- package/test.js +0 -4242
- package/tmp.js +0 -1
package/monad/Instance.test.js
DELETED
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
const assert = require('assert')
|
|
2
|
-
const Instance = require('./Instance')
|
|
3
|
-
|
|
4
|
-
describe('Instance', () => {
|
|
5
|
-
describe('new Instance(x any) -> Instance', () => {
|
|
6
|
-
it('x 1; Instance<1>', async () => {
|
|
7
|
-
assert.strictEqual(new Instance(1).constructor.name, 'Instance')
|
|
8
|
-
assert(new Instance(1).value === 1)
|
|
9
|
-
})
|
|
10
|
-
it('x null; Instance<null>', async () => {
|
|
11
|
-
assert.strictEqual(new Instance(null).constructor.name, 'Instance')
|
|
12
|
-
assert(new Instance(null).value === null)
|
|
13
|
-
})
|
|
14
|
-
it('x undefined; Instance<undefined>', async () => {
|
|
15
|
-
assert.strictEqual(new Instance(undefined).constructor.name, 'Instance')
|
|
16
|
-
assert(new Instance(undefined).value === undefined)
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe('<A any, B any>new Instance(x A).chain(f A=>Instance<B>) -> Instance<B>', () => {
|
|
21
|
-
it('x 1; f x=>x; 1', async () => {
|
|
22
|
-
assert.strictEqual(new Instance(1).chain(x => x), 1)
|
|
23
|
-
})
|
|
24
|
-
it('x 1; f x=>Instance(x + 1); Instance { 2 }', async () => {
|
|
25
|
-
assert.deepEqual(new Instance(1).chain(x => new Instance(x + 1)), new Instance(2))
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
describe('Instance.isInstance(x any) -> boolean', () => {
|
|
30
|
-
it('x 1; true', async () => {
|
|
31
|
-
assert.strictEqual(Instance.isInstance(1), true)
|
|
32
|
-
})
|
|
33
|
-
it('x null; false', async () => {
|
|
34
|
-
assert.strictEqual(Instance.isInstance(null), false)
|
|
35
|
-
})
|
|
36
|
-
it('x undefined; false', async () => {
|
|
37
|
-
assert.strictEqual(Instance.isInstance(undefined), false)
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
describe('Instance.is(x any, constructor function) -> boolean', () => {
|
|
42
|
-
it('x 1, constructor Number; true', async () => {
|
|
43
|
-
assert.strictEqual(Instance.is(1, Number), true)
|
|
44
|
-
})
|
|
45
|
-
it('x 1, constructor String; false', async () => {
|
|
46
|
-
assert.strictEqual(Instance.is(1, String), false)
|
|
47
|
-
})
|
|
48
|
-
it('x null; false', async () => {
|
|
49
|
-
assert.strictEqual(Instance.is(null, Object), false)
|
|
50
|
-
})
|
|
51
|
-
it('x undefined; false', async () => {
|
|
52
|
-
assert.strictEqual(Instance.is(undefined, Object), false)
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
describe('new Instance(x any).is(constructor function) -> boolean', () => {
|
|
57
|
-
it('x 1, constructor Number; true', async () => {
|
|
58
|
-
assert.strictEqual(new Instance(1).is(Number), true)
|
|
59
|
-
})
|
|
60
|
-
it('x 1, constructor String; false', async () => {
|
|
61
|
-
assert.strictEqual(new Instance(1).is(String), false)
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
describe('Instance.isString(x any) -> boolean', () => {
|
|
66
|
-
it('x \'hey\'; true', async () => {
|
|
67
|
-
assert.strictEqual(Instance.isString('hey'), true)
|
|
68
|
-
})
|
|
69
|
-
it('x 3; false', async () => {
|
|
70
|
-
assert.strictEqual(Instance.isString(3), false)
|
|
71
|
-
})
|
|
72
|
-
it('x null; false', async () => {
|
|
73
|
-
assert.strictEqual(Instance.isString(null), false)
|
|
74
|
-
})
|
|
75
|
-
it('x undefined; false', async () => {
|
|
76
|
-
assert.strictEqual(Instance.isString(undefined), false)
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
describe('new Instance(x any).isString() -> boolean', () => {
|
|
81
|
-
it('x \'hey\'; true', async () => {
|
|
82
|
-
assert.strictEqual(new Instance('hey').isString(), true)
|
|
83
|
-
})
|
|
84
|
-
it('x 3; false', async () => {
|
|
85
|
-
assert.strictEqual(new Instance(3).isString(), false)
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
describe('Instance.isNumber(x any) -> boolean', () => {
|
|
90
|
-
it('x 3; true', async () => {
|
|
91
|
-
assert.strictEqual(Instance.isNumber(3), true)
|
|
92
|
-
})
|
|
93
|
-
it('x true; false', async () => {
|
|
94
|
-
assert.strictEqual(Instance.isNumber(true), false)
|
|
95
|
-
})
|
|
96
|
-
it('x null; false', async () => {
|
|
97
|
-
assert.strictEqual(Instance.isNumber(null), false)
|
|
98
|
-
})
|
|
99
|
-
it('x undefined; false', async () => {
|
|
100
|
-
assert.strictEqual(Instance.isNumber(undefined), false)
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
describe('new Instance(x any).isNumber() -> boolean', () => {
|
|
105
|
-
it('x 3; true', async () => {
|
|
106
|
-
assert.strictEqual(new Instance(3).isNumber(), true)
|
|
107
|
-
})
|
|
108
|
-
it('x true; false', async () => {
|
|
109
|
-
assert.strictEqual(new Instance(false).isNumber(), false)
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
describe('Instance.isArray(x any) -> boolean', () => {
|
|
114
|
-
it('x [1, 2, 3]; true', async () => {
|
|
115
|
-
assert.strictEqual(Instance.isArray([1, 2, 3]), true)
|
|
116
|
-
})
|
|
117
|
-
it('x 1; false', async () => {
|
|
118
|
-
assert.strictEqual(Instance.isArray(1), false)
|
|
119
|
-
})
|
|
120
|
-
it('x null; false', async () => {
|
|
121
|
-
assert.strictEqual(Instance.isArray(null), false)
|
|
122
|
-
})
|
|
123
|
-
it('x undefined; false', async () => {
|
|
124
|
-
assert.strictEqual(Instance.isArray(undefined), false)
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
describe('new Instance(x any).isArray() -> boolean', () => {
|
|
129
|
-
it('x [1, 2, 3]; true', async () => {
|
|
130
|
-
assert.strictEqual(new Instance([1, 2, 3]).isArray(), true)
|
|
131
|
-
})
|
|
132
|
-
it('x 1; false', async () => {
|
|
133
|
-
assert.strictEqual(new Instance(1).isArray(), false)
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
describe('Instance.isObject(x any) -> boolean', () => {
|
|
138
|
-
it('x { a: 1, b: 2, c: 3 }; true', async () => {
|
|
139
|
-
assert.strictEqual(Instance.isObject({ a: 1, b: 2, c: 3 }), true)
|
|
140
|
-
})
|
|
141
|
-
it('x []; false', async () => {
|
|
142
|
-
assert.strictEqual(Instance.isObject([]), false)
|
|
143
|
-
})
|
|
144
|
-
it('x null; false', async () => {
|
|
145
|
-
assert.strictEqual(Instance.isObject(null), false)
|
|
146
|
-
})
|
|
147
|
-
it('x undefined; false', async () => {
|
|
148
|
-
assert.strictEqual(Instance.isObject(undefined), false)
|
|
149
|
-
})
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
describe('new Instance(x any).isObject() -> boolean', () => {
|
|
153
|
-
it('x { a: 1, b: 2, c: 3 }; true', async () => {
|
|
154
|
-
assert.strictEqual(new Instance({ a: 1, b: 2, c: 3 }).isObject(), true)
|
|
155
|
-
})
|
|
156
|
-
it('x []; false', async () => {
|
|
157
|
-
assert.strictEqual(new Instance([]).isObject(), false)
|
|
158
|
-
})
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
describe('Instance.isSet(x any) -> boolean', () => {
|
|
162
|
-
it('x Set<[1, 2, 3]>; true', async () => {
|
|
163
|
-
assert.strictEqual(Instance.isSet(new Set([1, 2, 3])), true)
|
|
164
|
-
})
|
|
165
|
-
it('x [1, 2, 3]; false', async () => {
|
|
166
|
-
assert.strictEqual(Instance.isSet([1, 2, 3]), false)
|
|
167
|
-
})
|
|
168
|
-
it('x null; false', async () => {
|
|
169
|
-
assert.strictEqual(Instance.isSet(null), false)
|
|
170
|
-
})
|
|
171
|
-
it('x undefined; false', async () => {
|
|
172
|
-
assert.strictEqual(Instance.isSet(undefined), false)
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
describe('new Instance(x any).isSet() -> boolean', () => {
|
|
177
|
-
it('x Set<[1, 2, 3]>; true', async () => {
|
|
178
|
-
assert.strictEqual(new Instance(new Set([1, 2, 3])).isSet(), true)
|
|
179
|
-
})
|
|
180
|
-
it('x [1, 2, 3]; false', async () => {
|
|
181
|
-
assert.strictEqual(new Instance([1, 2, 3]).isSet(), false)
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
describe('Instance.isMap(x any) -> boolean', () => {
|
|
186
|
-
it('x Map<[[1, true], [2, false], [3, true]]>; true', async () => {
|
|
187
|
-
const m = new Map([[1, true], [2, false], [3, true]])
|
|
188
|
-
assert.strictEqual(Instance.isMap(m), true)
|
|
189
|
-
})
|
|
190
|
-
it('x { a: 1, b: 2, c: 3 }; false', async () => {
|
|
191
|
-
assert.strictEqual(Instance.isMap({ a: 1, b: 2, c: 3 }), false)
|
|
192
|
-
})
|
|
193
|
-
it('x null; false', async () => {
|
|
194
|
-
assert.strictEqual(Instance.isMap(null), false)
|
|
195
|
-
})
|
|
196
|
-
it('x undefined; false', async () => {
|
|
197
|
-
assert.strictEqual(Instance.isMap(undefined), false)
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
describe('new Instance(x any).isMap() -> boolean', () => {
|
|
202
|
-
it('x Map<[[1, true], [2, false], [3, true]]>; true', async () => {
|
|
203
|
-
const m = new Map([[1, true], [2, false], [3, true]])
|
|
204
|
-
assert.strictEqual(new Instance(m).isMap(), true)
|
|
205
|
-
})
|
|
206
|
-
it('x { a: 1, b: 2, c: 3 }; false', async () => {
|
|
207
|
-
assert.strictEqual(new Instance({ a: 1, b: 2, c: 3 }).isMap(), false)
|
|
208
|
-
})
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
describe('Instance.isIterable(x any) -> boolean', () => {
|
|
212
|
-
it('x [1, 2, 3]; true', async () => {
|
|
213
|
-
assert.strictEqual(Instance.isIterable([1, 2, 3]), true)
|
|
214
|
-
})
|
|
215
|
-
it('x { a: 1, b: 2, c: 3 }; false', async () => {
|
|
216
|
-
assert.strictEqual(Instance.isIterable({ a: 1, b: 2, c: 3 }), false)
|
|
217
|
-
})
|
|
218
|
-
it('x null; false', async () => {
|
|
219
|
-
assert.strictEqual(Instance.isIterable(null), false)
|
|
220
|
-
})
|
|
221
|
-
it('x undefined; false', async () => {
|
|
222
|
-
assert.strictEqual(Instance.isIterable(undefined), false)
|
|
223
|
-
})
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
describe('new Instance(x any).isIterable() -> boolean', () => {
|
|
227
|
-
it('x [1, 2, 3]; true', async () => {
|
|
228
|
-
assert.strictEqual(new Instance([1, 2, 3]).isIterable(), true)
|
|
229
|
-
})
|
|
230
|
-
it('x { a: 1, b: 2, c: 3 }; false', async () => {
|
|
231
|
-
assert.strictEqual(new Instance({ a: 1, b: 2, c: 3 }).isIterable(), false)
|
|
232
|
-
})
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
describe('Instance.isAsyncIterable(x any) -> boolean', () => {
|
|
236
|
-
const createAsyncIterable123 = async function*() {
|
|
237
|
-
yield 1; yield 2; yield 3
|
|
238
|
-
}
|
|
239
|
-
it('x AsyncIterable<[1, 2, 3]>; true', async () => {
|
|
240
|
-
assert.strictEqual(Instance.isAsyncIterable(createAsyncIterable123()), true)
|
|
241
|
-
})
|
|
242
|
-
it('x [1, 2, 3]; false', async () => {
|
|
243
|
-
assert.strictEqual(Instance.isAsyncIterable([1, 2, 3]), false)
|
|
244
|
-
})
|
|
245
|
-
it('x null; false', async () => {
|
|
246
|
-
assert.strictEqual(Instance.isAsyncIterable(null), false)
|
|
247
|
-
})
|
|
248
|
-
it('x undefined; false', async () => {
|
|
249
|
-
assert.strictEqual(Instance.isAsyncIterable(undefined), false)
|
|
250
|
-
})
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
describe('new Instance(x any).isAsyncIterable() -> boolean', () => {
|
|
254
|
-
const createAsyncIterable123 = async function*() {
|
|
255
|
-
yield 1; yield 2; yield 3
|
|
256
|
-
}
|
|
257
|
-
it('x AsyncIterable<[1, 2, 3]>; true', async () => {
|
|
258
|
-
assert.strictEqual(new Instance(createAsyncIterable123()).isAsyncIterable(), true)
|
|
259
|
-
})
|
|
260
|
-
it('x [1, 2, 3]; false', async () => {
|
|
261
|
-
assert.strictEqual(new Instance([1, 2, 3]).isAsyncIterable(), false)
|
|
262
|
-
})
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
describe('Instance.isFunction(x any) -> boolean', () => {
|
|
266
|
-
it('x function; true', async () => {
|
|
267
|
-
assert.strictEqual(Instance.isFunction(function(){}), true)
|
|
268
|
-
})
|
|
269
|
-
it('x AsyncFunction; true', async () => {
|
|
270
|
-
assert.strictEqual(Instance.isFunction(async function(){}), true)
|
|
271
|
-
})
|
|
272
|
-
it('x ()=>{}; true', async () => {
|
|
273
|
-
assert.strictEqual(Instance.isFunction(() => {}), true)
|
|
274
|
-
})
|
|
275
|
-
it('x async ()=>{}; true', async () => {
|
|
276
|
-
assert.strictEqual(Instance.isFunction(async () => {}), true)
|
|
277
|
-
})
|
|
278
|
-
it('x GeneratorFunction; true', async () => {
|
|
279
|
-
assert.strictEqual(Instance.isFunction(function*(){}), true)
|
|
280
|
-
})
|
|
281
|
-
it('x AsyncGeneratorFunction; true', async () => {
|
|
282
|
-
assert.strictEqual(Instance.isFunction(async function*(){}), true)
|
|
283
|
-
})
|
|
284
|
-
it('x 1; false', async () => {
|
|
285
|
-
assert.strictEqual(Instance.isFunction(1), false)
|
|
286
|
-
})
|
|
287
|
-
it('x null; false', async () => {
|
|
288
|
-
assert.strictEqual(Instance.isFunction(null), false)
|
|
289
|
-
})
|
|
290
|
-
it('x undefined; false', async () => {
|
|
291
|
-
assert.strictEqual(Instance.isFunction(undefined), false)
|
|
292
|
-
})
|
|
293
|
-
})
|
|
294
|
-
|
|
295
|
-
describe('new Instance(x any).isFunction() -> boolean', () => {
|
|
296
|
-
it('x function; true', async () => {
|
|
297
|
-
assert.strictEqual(new Instance(function(){}).isFunction(), true)
|
|
298
|
-
})
|
|
299
|
-
it('x AsyncFunction; true', async () => {
|
|
300
|
-
assert.strictEqual(new Instance(async function(){}).isFunction(), true)
|
|
301
|
-
})
|
|
302
|
-
it('x ()=>{}; true', async () => {
|
|
303
|
-
assert.strictEqual(new Instance(() => {}).isFunction(), true)
|
|
304
|
-
})
|
|
305
|
-
it('x async ()=>{}; true', async () => {
|
|
306
|
-
assert.strictEqual(new Instance(async () => {}).isFunction(), true)
|
|
307
|
-
})
|
|
308
|
-
it('x GeneratorFunction; true', async () => {
|
|
309
|
-
assert.strictEqual(new Instance(function*(){}).isFunction(), true)
|
|
310
|
-
})
|
|
311
|
-
it('x AsyncGeneratorFunction; true', async () => {
|
|
312
|
-
assert.strictEqual(new Instance(async function*(){}).isFunction(), true)
|
|
313
|
-
})
|
|
314
|
-
it('x 1; false', async () => {
|
|
315
|
-
assert.strictEqual(new Instance(1).isFunction(), false)
|
|
316
|
-
})
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
describe('Instance.isReadable(x any) -> boolean', () => {
|
|
320
|
-
it('x { read: function }; true', async () => {
|
|
321
|
-
assert.strictEqual(Instance.isReadable({ read: function(){} }), true)
|
|
322
|
-
})
|
|
323
|
-
it('x function; false', async () => {
|
|
324
|
-
assert.strictEqual(Instance.isReadable(function(){}), false)
|
|
325
|
-
})
|
|
326
|
-
it('x null; false', async () => {
|
|
327
|
-
assert.strictEqual(Instance.isReadable(null), false)
|
|
328
|
-
})
|
|
329
|
-
it('x undefined; false', async () => {
|
|
330
|
-
assert.strictEqual(Instance.isReadable(undefined), false)
|
|
331
|
-
})
|
|
332
|
-
})
|
|
333
|
-
|
|
334
|
-
describe('new Instance(x any).isReadable() -> boolean', () => {
|
|
335
|
-
it('x { read: function }; true', async () => {
|
|
336
|
-
assert.strictEqual(new Instance({ read: function(){} }).isReadable(), true)
|
|
337
|
-
})
|
|
338
|
-
it('x function; false', async () => {
|
|
339
|
-
assert.strictEqual(new Instance(function(){}).isReadable(), false)
|
|
340
|
-
})
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
describe('Instance.isWritable(x any) -> boolean', () => {
|
|
344
|
-
it('x { write: function }; true', async () => {
|
|
345
|
-
assert.strictEqual(Instance.isWritable({ write: function(){} }), true)
|
|
346
|
-
})
|
|
347
|
-
it('x function; false', async () => {
|
|
348
|
-
assert.strictEqual(Instance.isWritable(function(){}), false)
|
|
349
|
-
})
|
|
350
|
-
it('x null; false', async () => {
|
|
351
|
-
assert.strictEqual(Instance.isWritable(null), false)
|
|
352
|
-
})
|
|
353
|
-
it('x undefined; false', async () => {
|
|
354
|
-
assert.strictEqual(Instance.isWritable(undefined), false)
|
|
355
|
-
})
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
describe('new Instance(x any).isWritable() -> boolean', () => {
|
|
359
|
-
it('x { write: function }; true', async () => {
|
|
360
|
-
assert.strictEqual(new Instance({ write: function(){} }).isWritable(), true)
|
|
361
|
-
})
|
|
362
|
-
it('x function; false', async () => {
|
|
363
|
-
assert.strictEqual(new Instance(function(){}).isWritable(), false)
|
|
364
|
-
})
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
describe('Instance.isPromise(x any) -> boolean', () => {
|
|
368
|
-
it('x { then: function }; true', async () => {
|
|
369
|
-
assert.strictEqual(Instance.isPromise({ then: function(){} }), true)
|
|
370
|
-
})
|
|
371
|
-
it('x Promise.resolve(); true', async () => {
|
|
372
|
-
assert.strictEqual(Instance.isPromise(Promise.resolve()), true)
|
|
373
|
-
})
|
|
374
|
-
it('x function; false', async () => {
|
|
375
|
-
assert.strictEqual(Instance.isPromise(function(){}), false)
|
|
376
|
-
})
|
|
377
|
-
it('x null; false', async () => {
|
|
378
|
-
assert.strictEqual(Instance.isPromise(null), false)
|
|
379
|
-
})
|
|
380
|
-
it('x undefined; false', async () => {
|
|
381
|
-
assert.strictEqual(Instance.isPromise(undefined), false)
|
|
382
|
-
})
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
describe('new Instance(x any).isPromise() -> boolean', () => {
|
|
386
|
-
it('x { then: function }; true', async () => {
|
|
387
|
-
assert.strictEqual(new Instance({ then: function(){} }).isPromise(), true)
|
|
388
|
-
})
|
|
389
|
-
it('x Promise.resolve(); true', async () => {
|
|
390
|
-
assert.strictEqual(new Instance(Promise.resolve()).isPromise(), true)
|
|
391
|
-
})
|
|
392
|
-
it('x function; false', async () => {
|
|
393
|
-
assert.strictEqual(new Instance(function(){}).isPromise(), false)
|
|
394
|
-
})
|
|
395
|
-
})
|
|
396
|
-
|
|
397
|
-
describe('Instance.isTypedArray(x any) -> boolean', () => {
|
|
398
|
-
it('x TypedArray<[1, 2, 3]>; true', async () => {
|
|
399
|
-
assert.strictEqual(Instance.isTypedArray(new Uint8Array([1, 2, 3])), true)
|
|
400
|
-
assert.strictEqual(Instance.isTypedArray(new Int8Array([1, 2, 3])), true)
|
|
401
|
-
assert.strictEqual(Instance.isTypedArray(new Uint16Array([1, 2, 3])), true)
|
|
402
|
-
assert.strictEqual(Instance.isTypedArray(new Int16Array([1, 2, 3])), true)
|
|
403
|
-
assert.strictEqual(Instance.isTypedArray(new Uint32Array([1, 2, 3])), true)
|
|
404
|
-
assert.strictEqual(Instance.isTypedArray(new Int32Array([1, 2, 3])), true)
|
|
405
|
-
assert.strictEqual(Instance.isTypedArray(new Float32Array([1, 2, 3])), true)
|
|
406
|
-
assert.strictEqual(Instance.isTypedArray(new Float64Array([1, 2, 3])), true)
|
|
407
|
-
assert.strictEqual(Instance.isTypedArray(new BigUint64Array([1n, 2n, 3n])), true)
|
|
408
|
-
assert.strictEqual(Instance.isTypedArray(new BigInt64Array([1n, 2n, 3n])), true)
|
|
409
|
-
})
|
|
410
|
-
it('x [1, 2, 3]; false', async () => {
|
|
411
|
-
assert.strictEqual(Instance.isTypedArray([1, 2, 3]), false)
|
|
412
|
-
})
|
|
413
|
-
it('x ArrayBuffer; false', async () => {
|
|
414
|
-
assert.strictEqual(Instance.isTypedArray(new ArrayBuffer()), false)
|
|
415
|
-
})
|
|
416
|
-
it('x null; false', async () => {
|
|
417
|
-
assert.strictEqual(Instance.isTypedArray(null), false)
|
|
418
|
-
})
|
|
419
|
-
it('x undefined; false', async () => {
|
|
420
|
-
assert.strictEqual(Instance.isTypedArray(undefined), false)
|
|
421
|
-
})
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
describe('new Instance(x any).isTypedArray() -> boolean', () => {
|
|
425
|
-
it('x Uint8Array<[1, 2, 3]>; true', async () => {
|
|
426
|
-
assert.strictEqual(new Instance(new Uint8Array([1, 2, 3])).isTypedArray(), true)
|
|
427
|
-
assert.strictEqual(new Instance(new Uint8Array([1, 2, 3])).isTypedArray(), true)
|
|
428
|
-
assert.strictEqual(new Instance(new Int8Array([1, 2, 3])).isTypedArray(), true)
|
|
429
|
-
assert.strictEqual(new Instance(new Uint16Array([1, 2, 3])).isTypedArray(), true)
|
|
430
|
-
assert.strictEqual(new Instance(new Int16Array([1, 2, 3])).isTypedArray(), true)
|
|
431
|
-
assert.strictEqual(new Instance(new Uint32Array([1, 2, 3])).isTypedArray(), true)
|
|
432
|
-
assert.strictEqual(new Instance(new Int32Array([1, 2, 3])).isTypedArray(), true)
|
|
433
|
-
assert.strictEqual(new Instance(new Float32Array([1, 2, 3])).isTypedArray(), true)
|
|
434
|
-
assert.strictEqual(new Instance(new Float64Array([1, 2, 3])).isTypedArray(), true)
|
|
435
|
-
assert.strictEqual(new Instance(new BigUint64Array([1n, 2n, 3n])).isTypedArray(), true)
|
|
436
|
-
assert.strictEqual(new Instance(new BigInt64Array([1n, 2n, 3n])).isTypedArray(), true)
|
|
437
|
-
})
|
|
438
|
-
it('x [1, 2, 3]; false', async () => {
|
|
439
|
-
assert.strictEqual(new Instance([1, 2, 3]).isTypedArray(), false)
|
|
440
|
-
})
|
|
441
|
-
it('x ArrayBuffer; false', () => {
|
|
442
|
-
assert.strictEqual(new Instance(new ArrayBuffer()).isTypedArray(), false)
|
|
443
|
-
})
|
|
444
|
-
})
|
|
445
|
-
})
|
package/monad/Mux.benchmark.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const timeInLoop = require('../x/timeInLoop')
|
|
2
|
-
const Mux = require('./Mux')
|
|
3
|
-
const _ = require('lodash')
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @name Mux.flatten
|
|
7
|
-
*
|
|
8
|
-
* @benchmark
|
|
9
|
-
* Mux.flatten(nested): 1e+5: 25.588ms
|
|
10
|
-
* _.flatten(nested): 1e+5: 28.935ms
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const muxConcat = Mux.concat
|
|
14
|
-
|
|
15
|
-
const nested = [[1], 2, [[3]]]
|
|
16
|
-
|
|
17
|
-
const muxConcatFlatten = arr => {
|
|
18
|
-
const y = []
|
|
19
|
-
for (const item of muxConcat(arr)) y.push(item)
|
|
20
|
-
return y
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const muxFlatten = Mux.flatten
|
|
24
|
-
|
|
25
|
-
const _flatten = _.flatten
|
|
26
|
-
|
|
27
|
-
// timeInLoop('Mux.flatten(nested)', 1e5, () => { muxFlatten(nested) })
|
|
28
|
-
|
|
29
|
-
// timeInLoop('_.flatten(nested)', 1e5, () => { _flatten(nested) })
|