@zajno/common 2.0.3 → 2.0.5
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 +3 -3
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.d.ts +0 -0
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.d.ts.map +0 -0
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.js +0 -0
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.js.map +0 -0
- package/{lib/async → async}/arrays.d.ts +0 -0
- package/{lib/async → async}/arrays.d.ts.map +0 -0
- package/{lib/async → async}/arrays.extend.d.ts +0 -0
- package/{lib/async → async}/arrays.extend.d.ts.map +0 -0
- package/{lib/async → async}/arrays.extend.js +0 -0
- package/{lib/async → async}/arrays.extend.js.map +0 -0
- package/{lib/async → async}/arrays.js +0 -0
- package/{lib/async → async}/arrays.js.map +0 -0
- package/{lib/async → async}/misc.d.ts +0 -0
- package/{lib/async → async}/misc.d.ts.map +0 -0
- package/{lib/async → async}/misc.js +0 -0
- package/{lib/async → async}/misc.js.map +0 -0
- package/{lib/async → async}/timeout.d.ts +0 -0
- package/{lib/async → async}/timeout.d.ts.map +0 -0
- package/{lib/async → async}/timeout.js +0 -0
- package/{lib/async → async}/timeout.js.map +0 -0
- package/{lib/controllers → controllers}/PluggableController.d.ts +0 -0
- package/{lib/controllers → controllers}/PluggableController.d.ts.map +0 -0
- package/{lib/controllers → controllers}/PluggableController.js +0 -0
- package/{lib/controllers → controllers}/PluggableController.js.map +0 -0
- package/{lib/dates → dates}/calc.d.ts +0 -0
- package/{lib/dates → dates}/calc.d.ts.map +0 -0
- package/{lib/dates → dates}/calc.js +0 -0
- package/{lib/dates → dates}/calc.js.map +0 -0
- package/{lib/dates → dates}/convert.d.ts +0 -0
- package/{lib/dates → dates}/convert.d.ts.map +0 -0
- package/{lib/dates → dates}/convert.js +0 -0
- package/{lib/dates → dates}/convert.js.map +0 -0
- package/{lib/dates → dates}/datex.d.ts +0 -0
- package/{lib/dates → dates}/datex.d.ts.map +0 -0
- package/{lib/dates → dates}/datex.js +0 -0
- package/{lib/dates → dates}/datex.js.map +0 -0
- package/{lib/dates → dates}/format.d.ts +0 -0
- package/{lib/dates → dates}/format.d.ts.map +0 -0
- package/{lib/dates → dates}/format.js +0 -0
- package/{lib/dates → dates}/format.js.map +0 -0
- package/{lib/dates → dates}/index.d.ts +0 -0
- package/{lib/dates → dates}/index.d.ts.map +0 -0
- package/{lib/dates → dates}/index.js +0 -0
- package/{lib/dates → dates}/index.js.map +0 -0
- package/{lib/dates → dates}/parse.d.ts +0 -0
- package/{lib/dates → dates}/parse.d.ts.map +0 -0
- package/{lib/dates → dates}/parse.js +0 -0
- package/{lib/dates → dates}/parse.js.map +0 -0
- package/{lib/dates → dates}/period.d.ts +0 -0
- package/{lib/dates → dates}/period.d.ts.map +0 -0
- package/{lib/dates → dates}/period.js +0 -0
- package/{lib/dates → dates}/period.js.map +0 -0
- package/{lib/dates → dates}/shift.d.ts +0 -0
- package/{lib/dates → dates}/shift.d.ts.map +0 -0
- package/{lib/dates → dates}/shift.js +0 -0
- package/{lib/dates → dates}/shift.js.map +0 -0
- package/{lib/dates → dates}/types.d.ts +0 -0
- package/{lib/dates → dates}/types.d.ts.map +0 -0
- package/{lib/dates → dates}/types.js +0 -0
- package/{lib/dates → dates}/types.js.map +0 -0
- package/{lib/dates → dates}/yearDate.d.ts +0 -0
- package/{lib/dates → dates}/yearDate.d.ts.map +0 -0
- package/{lib/dates → dates}/yearDate.js +0 -0
- package/{lib/dates → dates}/yearDate.js.map +0 -0
- package/{lib/fields → fields}/filter.d.ts +0 -0
- package/{lib/fields → fields}/filter.d.ts.map +0 -0
- package/{lib/fields → fields}/filter.js +0 -0
- package/{lib/fields → fields}/filter.js.map +0 -0
- package/{lib/fields → fields}/index.d.ts +0 -0
- package/{lib/fields → fields}/index.d.ts.map +0 -0
- package/{lib/fields → fields}/index.js +0 -0
- package/{lib/fields → fields}/index.js.map +0 -0
- package/{lib/fields → fields}/transfer.d.ts +0 -0
- package/{lib/fields → fields}/transfer.d.ts.map +0 -0
- package/{lib/fields → fields}/transfer.js +0 -0
- package/{lib/fields → fields}/transfer.js.map +0 -0
- package/{lib/fields → fields}/update.d.ts +0 -0
- package/{lib/fields → fields}/update.d.ts.map +0 -0
- package/{lib/fields → fields}/update.js +0 -0
- package/{lib/fields → fields}/update.js.map +0 -0
- package/{lib/functions → functions}/assert.d.ts +0 -0
- package/{lib/functions → functions}/assert.d.ts.map +0 -0
- package/{lib/functions → functions}/assert.js +0 -0
- package/{lib/functions → functions}/assert.js.map +0 -0
- package/{lib/functions → functions}/disposer.d.ts +0 -0
- package/{lib/functions → functions}/disposer.d.ts.map +0 -0
- package/{lib/functions → functions}/disposer.js +0 -0
- package/{lib/functions → functions}/disposer.js.map +0 -0
- package/{lib/functions → functions}/safeCall.d.ts +0 -0
- package/{lib/functions → functions}/safeCall.d.ts.map +0 -0
- package/{lib/functions → functions}/safeCall.js +0 -0
- package/{lib/functions → functions}/safeCall.js.map +0 -0
- package/{lib/functions → functions}/throttle.d.ts +0 -0
- package/{lib/functions → functions}/throttle.d.ts.map +0 -0
- package/{lib/functions → functions}/throttle.js +0 -0
- package/{lib/functions → functions}/throttle.js.map +0 -0
- package/{lib/lazy → lazy}/light.d.ts +0 -0
- package/{lib/lazy → lazy}/light.d.ts.map +0 -0
- package/{lib/lazy → lazy}/light.js +0 -0
- package/{lib/lazy → lazy}/light.js.map +0 -0
- package/{lib/lazy → lazy}/promise.d.ts +0 -0
- package/{lib/lazy → lazy}/promise.d.ts.map +0 -0
- package/{lib/lazy → lazy}/promise.js +0 -0
- package/{lib/lazy → lazy}/promise.js.map +0 -0
- package/{lib/lazy → lazy}/singleton.d.ts +0 -0
- package/{lib/lazy → lazy}/singleton.d.ts.map +0 -0
- package/{lib/lazy → lazy}/singleton.js +0 -0
- package/{lib/lazy → lazy}/singleton.js.map +0 -0
- package/{lib/logger → logger}/abstractions.d.ts +0 -0
- package/{lib/logger → logger}/abstractions.d.ts.map +0 -0
- package/{lib/logger → logger}/abstractions.js +0 -0
- package/{lib/logger → logger}/abstractions.js.map +0 -0
- package/{lib/logger → logger}/batch.d.ts +0 -0
- package/{lib/logger → logger}/batch.d.ts.map +0 -0
- package/{lib/logger → logger}/batch.js +0 -0
- package/{lib/logger → logger}/batch.js.map +0 -0
- package/{lib/logger → logger}/console.d.ts +0 -0
- package/{lib/logger → logger}/console.d.ts.map +0 -0
- package/{lib/logger → logger}/console.js +0 -0
- package/{lib/logger → logger}/console.js.map +0 -0
- package/{lib/logger → logger}/file.d.ts +0 -0
- package/{lib/logger → logger}/file.d.ts.map +0 -0
- package/{lib/logger → logger}/file.js +0 -0
- package/{lib/logger → logger}/file.js.map +0 -0
- package/{lib/logger → logger}/index.d.ts +0 -0
- package/{lib/logger → logger}/index.d.ts.map +0 -0
- package/{lib/logger → logger}/index.js +0 -0
- package/{lib/logger → logger}/index.js.map +0 -0
- package/{lib/logger → logger}/named.d.ts +0 -0
- package/{lib/logger → logger}/named.d.ts.map +0 -0
- package/{lib/logger → logger}/named.js +0 -0
- package/{lib/logger → logger}/named.js.map +0 -0
- package/{lib/logger → logger}/proxy.d.ts +0 -0
- package/{lib/logger → logger}/proxy.d.ts.map +0 -0
- package/{lib/logger → logger}/proxy.js +0 -0
- package/{lib/logger → logger}/proxy.js.map +0 -0
- package/{lib/math → math}/arrays.d.ts +0 -0
- package/{lib/math → math}/arrays.d.ts.map +0 -0
- package/{lib/math → math}/arrays.js +0 -0
- package/{lib/math → math}/arrays.js.map +0 -0
- package/{lib/math → math}/calc.d.ts +0 -0
- package/{lib/math → math}/calc.d.ts.map +0 -0
- package/{lib/math → math}/calc.js +0 -0
- package/{lib/math → math}/calc.js.map +0 -0
- package/{lib/math → math}/distribution.d.ts +0 -0
- package/{lib/math → math}/distribution.d.ts.map +0 -0
- package/{lib/math → math}/distribution.js +0 -0
- package/{lib/math → math}/distribution.js.map +0 -0
- package/{lib/math → math}/index.d.ts +0 -0
- package/{lib/math → math}/index.d.ts.map +0 -0
- package/{lib/math → math}/index.js +0 -0
- package/{lib/math → math}/index.js.map +0 -0
- package/{lib/models → models}/EntityWithStatus.d.ts +0 -0
- package/{lib/models → models}/EntityWithStatus.d.ts.map +0 -0
- package/{lib/models → models}/EntityWithStatus.js +0 -0
- package/{lib/models → models}/EntityWithStatus.js.map +0 -0
- package/{lib/models → models}/File.d.ts +0 -0
- package/{lib/models → models}/File.d.ts.map +0 -0
- package/{lib/models → models}/File.js +0 -0
- package/{lib/models → models}/File.js.map +0 -0
- package/models/Model.d.ts +12 -0
- package/models/Model.d.ts.map +1 -0
- package/models/Model.js +23 -0
- package/models/Model.js.map +1 -0
- package/models/ValuesCollector.d.ts +26 -0
- package/models/ValuesCollector.d.ts.map +1 -0
- package/models/ValuesCollector.js +51 -0
- package/models/ValuesCollector.js.map +1 -0
- package/models/types.d.ts +19 -0
- package/models/types.d.ts.map +1 -0
- package/models/types.js +3 -0
- package/models/types.js.map +1 -0
- package/models/wrappers.d.ts +12 -0
- package/models/wrappers.d.ts.map +1 -0
- package/models/wrappers.js +43 -0
- package/models/wrappers.js.map +1 -0
- package/{lib/observing → observing}/event.d.ts +0 -0
- package/{lib/observing → observing}/event.d.ts.map +0 -0
- package/{lib/observing → observing}/event.js +0 -0
- package/{lib/observing → observing}/event.js.map +0 -0
- package/{lib/observing → observing}/progressTracker.d.ts +0 -0
- package/{lib/observing → observing}/progressTracker.d.ts.map +0 -0
- package/{lib/observing → observing}/progressTracker.js +0 -0
- package/{lib/observing → observing}/progressTracker.js.map +0 -0
- package/{lib/observing → observing}/throttledEvent.d.ts +0 -0
- package/{lib/observing → observing}/throttledEvent.d.ts.map +0 -0
- package/{lib/observing → observing}/throttledEvent.js +0 -0
- package/{lib/observing → observing}/throttledEvent.js.map +0 -0
- package/{lib/observing → observing}/timer.d.ts +0 -0
- package/{lib/observing → observing}/timer.d.ts.map +0 -0
- package/{lib/observing → observing}/timer.js +0 -0
- package/{lib/observing → observing}/timer.js.map +0 -0
- package/package.json +8 -11
- package/{lib/storage → storage}/abstractions.d.ts +0 -0
- package/{lib/storage → storage}/abstractions.d.ts.map +0 -0
- package/{lib/storage → storage}/abstractions.js +0 -0
- package/{lib/storage → storage}/abstractions.js.map +0 -0
- package/{lib/storage → storage}/asyncWrapper.d.ts +0 -0
- package/{lib/storage → storage}/asyncWrapper.d.ts.map +0 -0
- package/{lib/storage → storage}/asyncWrapper.js +0 -0
- package/{lib/storage → storage}/asyncWrapper.js.map +0 -0
- package/{lib/storage → storage}/index.d.ts +0 -0
- package/{lib/storage → storage}/index.d.ts.map +0 -0
- package/{lib/storage → storage}/index.js +0 -0
- package/{lib/storage → storage}/index.js.map +0 -0
- package/{lib/storage → storage}/keyStorage.d.ts +0 -0
- package/{lib/storage → storage}/keyStorage.d.ts.map +0 -0
- package/{lib/storage → storage}/keyStorage.js +0 -0
- package/{lib/storage → storage}/keyStorage.js.map +0 -0
- package/{lib/structures → structures}/helpers/enum.d.ts +0 -0
- package/{lib/structures → structures}/helpers/enum.d.ts.map +0 -0
- package/{lib/structures → structures}/helpers/enum.js +0 -0
- package/{lib/structures → structures}/helpers/enum.js.map +0 -0
- package/{lib/structures → structures}/helpers/name.d.ts +0 -0
- package/{lib/structures → structures}/helpers/name.d.ts.map +0 -0
- package/{lib/structures → structures}/helpers/name.js +0 -0
- package/{lib/structures → structures}/helpers/name.js.map +0 -0
- package/{lib/structures → structures}/linkedList.d.ts +0 -0
- package/{lib/structures → structures}/linkedList.d.ts.map +0 -0
- package/{lib/structures → structures}/linkedList.js +0 -0
- package/{lib/structures → structures}/linkedList.js.map +0 -0
- package/{lib/structures → structures}/pool.d.ts +0 -0
- package/{lib/structures → structures}/pool.d.ts.map +0 -0
- package/{lib/structures → structures}/pool.js +0 -0
- package/{lib/structures → structures}/pool.js.map +0 -0
- package/{lib/structures → structures}/queue/parallel.d.ts +0 -0
- package/{lib/structures → structures}/queue/parallel.d.ts.map +0 -0
- package/{lib/structures → structures}/queue/parallel.js +0 -0
- package/{lib/structures → structures}/queue/parallel.js.map +0 -0
- package/{lib/structures → structures}/queue/tasks.d.ts +0 -0
- package/{lib/structures → structures}/queue/tasks.d.ts.map +0 -0
- package/{lib/structures → structures}/queue/tasks.js +0 -0
- package/{lib/structures → structures}/queue/tasks.js.map +0 -0
- package/{lib/structures → structures}/tempoCache.d.ts +0 -0
- package/{lib/structures → structures}/tempoCache.d.ts.map +0 -0
- package/{lib/structures → structures}/tempoCache.js +0 -0
- package/{lib/structures → structures}/tempoCache.js.map +0 -0
- package/{lib/types → types}/comparator.d.ts +0 -0
- package/{lib/types → types}/comparator.d.ts.map +0 -0
- package/{lib/types → types}/comparator.js +0 -0
- package/{lib/types → types}/comparator.js.map +0 -0
- package/{lib/types → types}/deep.d.ts +0 -0
- package/{lib/types → types}/deep.d.ts.map +0 -0
- package/{lib/types → types}/deep.js +0 -0
- package/{lib/types → types}/deep.js.map +0 -0
- package/{lib/types → types}/functions.d.ts +0 -0
- package/{lib/types → types}/functions.d.ts.map +0 -0
- package/{lib/types → types}/functions.js +0 -0
- package/{lib/types → types}/functions.js.map +0 -0
- package/{lib/types → types}/getter.d.ts +0 -0
- package/{lib/types → types}/getter.d.ts.map +1 -1
- package/{lib/types → types}/getter.js +0 -3
- package/types/getter.js.map +1 -0
- package/{lib/types → types}/ident.d.ts +0 -0
- package/{lib/types → types}/ident.d.ts.map +0 -0
- package/{lib/types → types}/ident.js +0 -0
- package/{lib/types → types}/ident.js.map +0 -0
- package/{lib/types → types}/index.d.ts +3 -0
- package/{lib/types → types}/index.d.ts.map +1 -1
- package/{lib/types → types}/index.js +0 -0
- package/{lib/types → types}/index.js.map +0 -0
- package/{lib/validation → validation}/ValidationErrors.d.ts +0 -0
- package/{lib/validation → validation}/ValidationErrors.d.ts.map +0 -0
- package/{lib/validation → validation}/ValidationErrors.js +0 -0
- package/{lib/validation → validation}/ValidationErrors.js.map +0 -0
- package/{lib/validation → validation}/creditCard.d.ts +0 -0
- package/{lib/validation → validation}/creditCard.d.ts.map +0 -0
- package/{lib/validation → validation}/creditCard.js +0 -0
- package/{lib/validation → validation}/creditCard.js.map +0 -0
- package/{lib/validation → validation}/emails.d.ts +0 -0
- package/{lib/validation → validation}/emails.d.ts.map +0 -0
- package/{lib/validation → validation}/emails.js +0 -0
- package/{lib/validation → validation}/emails.js.map +0 -0
- package/{lib/validation → validation}/helpers.d.ts +0 -0
- package/{lib/validation → validation}/helpers.d.ts.map +0 -0
- package/{lib/validation → validation}/helpers.js +0 -0
- package/{lib/validation → validation}/helpers.js.map +0 -0
- package/{lib/validation → validation}/index.d.ts +0 -0
- package/{lib/validation → validation}/index.d.ts.map +0 -0
- package/{lib/validation → validation}/index.js +0 -0
- package/{lib/validation → validation}/index.js.map +0 -0
- package/{lib/validation → validation}/types.d.ts +0 -0
- package/{lib/validation → validation}/types.d.ts.map +0 -0
- package/{lib/validation → validation}/types.js +0 -0
- package/{lib/validation → validation}/types.js.map +0 -0
- package/{lib/validation → validation}/validators.d.ts +0 -0
- package/{lib/validation → validation}/validators.d.ts.map +0 -0
- package/{lib/validation → validation}/validators.js +0 -0
- package/{lib/validation → validation}/validators.js.map +0 -0
- package/{lib/validation → validation}/wrappers.d.ts +0 -0
- package/{lib/validation → validation}/wrappers.d.ts.map +0 -0
- package/{lib/validation → validation}/wrappers.js +0 -0
- package/{lib/validation → validation}/wrappers.js.map +0 -0
- package/.eslintignore +0 -5
- package/.eslintrc.js +0 -9
- package/.github/workflows/CI.yml +0 -48
- package/.gitignore +0 -13
- package/.nvmrc +0 -1
- package/coverage/clover.xml +0 -1280
- package/coverage/coverage-final.json +0 -43
- package/coverage/lcov-report/CommonModel.ts.html +0 -215
- package/coverage/lcov-report/FlagModel.ts.html +0 -290
- package/coverage/lcov-report/MultiSelectModel.ts.html +0 -614
- package/coverage/lcov-report/NumberModel.ts.html +0 -230
- package/coverage/lcov-report/SelectModel.ts.html +0 -503
- package/coverage/lcov-report/Validatable.ts.html +0 -386
- package/coverage/lcov-report/__tests__/helpers/expect.ts.html +0 -94
- package/coverage/lcov-report/__tests__/helpers/index.html +0 -131
- package/coverage/lcov-report/__tests__/helpers/main.ts.html +0 -121
- package/coverage/lcov-report/async/arrays.ts.html +0 -199
- package/coverage/lcov-report/async/index.html +0 -131
- package/coverage/lcov-report/async/timeout.ts.html +0 -337
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/dates/calc.ts.html +0 -301
- package/coverage/lcov-report/dates/convert.ts.html +0 -658
- package/coverage/lcov-report/dates/datex.ts.html +0 -211
- package/coverage/lcov-report/dates/format.ts.html +0 -403
- package/coverage/lcov-report/dates/index.html +0 -251
- package/coverage/lcov-report/dates/index.ts.html +0 -112
- package/coverage/lcov-report/dates/parse.ts.html +0 -157
- package/coverage/lcov-report/dates/period.ts.html +0 -154
- package/coverage/lcov-report/dates/shift.ts.html +0 -355
- package/coverage/lcov-report/dates/types.ts.html +0 -181
- package/coverage/lcov-report/dates/yearDate.ts.html +0 -193
- package/coverage/lcov-report/disposer.ts.html +0 -376
- package/coverage/lcov-report/enumHelper.ts.html +0 -454
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/fields/index.html +0 -116
- package/coverage/lcov-report/fields/update.ts.html +0 -457
- package/coverage/lcov-report/functions/disposer.ts.html +0 -376
- package/coverage/lcov-report/functions/index.html +0 -116
- package/coverage/lcov-report/functions/safeCall.ts.html +0 -103
- package/coverage/lcov-report/index.html +0 -311
- package/coverage/lcov-report/lazy/index.html +0 -131
- package/coverage/lcov-report/lazy/light.ts.html +0 -172
- package/coverage/lcov-report/lazy/promise.ts.html +0 -241
- package/coverage/lcov-report/lazy/singleton.ts.html +0 -181
- package/coverage/lcov-report/logger/batch.ts.html +0 -112
- package/coverage/lcov-report/logger/console.ts.html +0 -241
- package/coverage/lcov-report/logger/index.html +0 -176
- package/coverage/lcov-report/logger/index.ts.html +0 -298
- package/coverage/lcov-report/logger/named.ts.html +0 -226
- package/coverage/lcov-report/logger/proxy.ts.html +0 -172
- package/coverage/lcov-report/math/arrays.ts.html +0 -907
- package/coverage/lcov-report/math/calc.ts.html +0 -292
- package/coverage/lcov-report/math/distribution.ts.html +0 -145
- package/coverage/lcov-report/math/index.html +0 -161
- package/coverage/lcov-report/math/index.ts.html +0 -166
- package/coverage/lcov-report/observing/event.ts.html +0 -358
- package/coverage/lcov-report/observing/index.html +0 -116
- package/coverage/lcov-report/observing/transition.ts.html +0 -634
- package/coverage/lcov-report/parallel.ts.html +0 -550
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/queue/index.html +0 -116
- package/coverage/lcov-report/queue/parallel.ts.html +0 -499
- package/coverage/lcov-report/queue/tasks.ts.html +0 -358
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/__tests__/helpers/expect.ts.html +0 -94
- package/coverage/lcov-report/src/__tests__/helpers/index.html +0 -131
- package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +0 -121
- package/coverage/lcov-report/src/async/arrays.ts.html +0 -199
- package/coverage/lcov-report/src/async/index.html +0 -131
- package/coverage/lcov-report/src/async/timeout.ts.html +0 -337
- package/coverage/lcov-report/src/cache.ts.html +0 -628
- package/coverage/lcov-report/src/dates/calc.ts.html +0 -301
- package/coverage/lcov-report/src/dates/convert.ts.html +0 -658
- package/coverage/lcov-report/src/dates/datex.ts.html +0 -211
- package/coverage/lcov-report/src/dates/format.ts.html +0 -403
- package/coverage/lcov-report/src/dates/index.html +0 -251
- package/coverage/lcov-report/src/dates/index.ts.html +0 -112
- package/coverage/lcov-report/src/dates/parse.ts.html +0 -157
- package/coverage/lcov-report/src/dates/period.ts.html +0 -154
- package/coverage/lcov-report/src/dates/shift.ts.html +0 -355
- package/coverage/lcov-report/src/dates/types.ts.html +0 -181
- package/coverage/lcov-report/src/dates/yearDate.ts.html +0 -193
- package/coverage/lcov-report/src/disposer.ts.html +0 -376
- package/coverage/lcov-report/src/enumHelper.ts.html +0 -454
- package/coverage/lcov-report/src/event.ts.html +0 -361
- package/coverage/lcov-report/src/fields/index.html +0 -116
- package/coverage/lcov-report/src/fields/update.ts.html +0 -457
- package/coverage/lcov-report/src/functions.ts.html +0 -127
- package/coverage/lcov-report/src/index.html +0 -251
- package/coverage/lcov-report/src/lazy/index.html +0 -161
- package/coverage/lcov-report/src/lazy/lazy.ts.html +0 -181
- package/coverage/lcov-report/src/lazy/light.ts.html +0 -172
- package/coverage/lcov-report/src/lazy/observable.ts.html +0 -196
- package/coverage/lcov-report/src/lazy/promise.ts.html +0 -241
- package/coverage/lcov-report/src/lazy/singleton.ts.html +0 -181
- package/coverage/lcov-report/src/lazy.light.ts.html +0 -172
- package/coverage/lcov-report/src/logger/batch.ts.html +0 -112
- package/coverage/lcov-report/src/logger/console.ts.html +0 -241
- package/coverage/lcov-report/src/logger/index.html +0 -176
- package/coverage/lcov-report/src/logger/index.ts.html +0 -298
- package/coverage/lcov-report/src/logger/named.ts.html +0 -226
- package/coverage/lcov-report/src/logger/proxy.ts.html +0 -172
- package/coverage/lcov-report/src/math/arrays.ts.html +0 -868
- package/coverage/lcov-report/src/math/calc.ts.html +0 -292
- package/coverage/lcov-report/src/math/distribution.ts.html +0 -145
- package/coverage/lcov-report/src/math/index.html +0 -161
- package/coverage/lcov-report/src/math/index.ts.html +0 -166
- package/coverage/lcov-report/src/observers.ts.html +0 -368
- package/coverage/lcov-report/src/observersMap.ts.html +0 -400
- package/coverage/lcov-report/src/observingCache.ts.html +0 -565
- package/coverage/lcov-report/src/queue/index.html +0 -131
- package/coverage/lcov-report/src/queue/parallel.ts.html +0 -511
- package/coverage/lcov-report/src/queue/tasks.ts.html +0 -358
- package/coverage/lcov-report/src/tempoCache.ts.html +0 -139
- package/coverage/lcov-report/src/transitionObserver.ts.html +0 -634
- package/coverage/lcov-report/src/types/comparator.ts.html +0 -103
- package/coverage/lcov-report/src/types/getter.ts.html +0 -127
- package/coverage/lcov-report/src/types/index.html +0 -146
- package/coverage/lcov-report/src/types/index.ts.html +0 -112
- package/coverage/lcov-report/src/types.ts.html +0 -175
- package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +0 -163
- package/coverage/lcov-report/src/validation/creditCard.ts.html +0 -160
- package/coverage/lcov-report/src/validation/helpers.ts.html +0 -226
- package/coverage/lcov-report/src/validation/index.html +0 -206
- package/coverage/lcov-report/src/validation/index.ts.html +0 -112
- package/coverage/lcov-report/src/validation/types.ts.html +0 -139
- package/coverage/lcov-report/src/validation/validators.ts.html +0 -250
- package/coverage/lcov-report/src/validation/wrappers.ts.html +0 -163
- package/coverage/lcov-report/src/viewModels/CommonModel.ts.html +0 -220
- package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +0 -295
- package/coverage/lcov-report/src/viewModels/LoadingModel.ts.html +0 -241
- package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +0 -619
- package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +0 -235
- package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +0 -541
- package/coverage/lcov-report/src/viewModels/TextModel.ts.html +0 -466
- package/coverage/lcov-report/src/viewModels/Validatable.ts.html +0 -391
- package/coverage/lcov-report/src/viewModels/index.html +0 -236
- package/coverage/lcov-report/src/viewModels/wrappers.ts.html +0 -232
- package/coverage/lcov-report/structures/helpers/enum.ts.html +0 -454
- package/coverage/lcov-report/structures/helpers/index.html +0 -116
- package/coverage/lcov-report/structures/index.html +0 -116
- package/coverage/lcov-report/structures/promiseCache.ts.html +0 -628
- package/coverage/lcov-report/structures/queue/index.html +0 -131
- package/coverage/lcov-report/structures/queue/parallel.ts.html +0 -511
- package/coverage/lcov-report/structures/queue/tasks.ts.html +0 -358
- package/coverage/lcov-report/structures/subscribersMap.ts.html +0 -400
- package/coverage/lcov-report/structures/subscribersPromiseCache.ts.html +0 -562
- package/coverage/lcov-report/structures/tempoCache.ts.html +0 -139
- package/coverage/lcov-report/tasks.ts.html +0 -355
- package/coverage/lcov-report/tempoCache.ts.html +0 -134
- package/coverage/lcov-report/timer.ts.html +0 -200
- package/coverage/lcov-report/types/comparator.ts.html +0 -103
- package/coverage/lcov-report/types/getter.ts.html +0 -127
- package/coverage/lcov-report/types/index.html +0 -146
- package/coverage/lcov-report/types/index.ts.html +0 -136
- package/coverage/lcov-report/update.ts.html +0 -374
- package/coverage/lcov-report/validation/ValidationErrors.ts.html +0 -163
- package/coverage/lcov-report/validation/creditCard.ts.html +0 -160
- package/coverage/lcov-report/validation/helpers.ts.html +0 -226
- package/coverage/lcov-report/validation/index.html +0 -206
- package/coverage/lcov-report/validation/index.ts.html +0 -112
- package/coverage/lcov-report/validation/types.ts.html +0 -139
- package/coverage/lcov-report/validation/validators.ts.html +0 -250
- package/coverage/lcov-report/validation/wrappers.ts.html +0 -163
- package/coverage/lcov-report/viewModels/CommonModel.ts.html +0 -215
- package/coverage/lcov-report/viewModels/FlagModel.ts.html +0 -290
- package/coverage/lcov-report/viewModels/LoadingModel.ts.html +0 -244
- package/coverage/lcov-report/viewModels/MultiSelectModel.ts.html +0 -614
- package/coverage/lcov-report/viewModels/NumberModel.ts.html +0 -230
- package/coverage/lcov-report/viewModels/SelectModel.ts.html +0 -536
- package/coverage/lcov-report/viewModels/TextModel.ts.html +0 -461
- package/coverage/lcov-report/viewModels/Validatable.ts.html +0 -386
- package/coverage/lcov-report/viewModels/index.html +0 -116
- package/coverage/lcov.info +0 -2763
- package/global-test-setup.js +0 -3
- package/jest.config.js +0 -10
- package/lib/types/getter.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/__tests__/helpers/expect.ts +0 -3
- package/src/__tests__/helpers/main.ts +0 -12
- package/src/abstractions/controllers/IPluggableController.ts +0 -7
- package/src/async/__tests__/timeout.test.ts +0 -74
- package/src/async/arrays.extend.ts +0 -17
- package/src/async/arrays.ts +0 -38
- package/src/async/misc.ts +0 -26
- package/src/async/timeout.ts +0 -84
- package/src/controllers/PluggableController.ts +0 -35
- package/src/dates/__tests__/dates.test.ts +0 -1314
- package/src/dates/calc.ts +0 -72
- package/src/dates/convert.ts +0 -191
- package/src/dates/datex.ts +0 -42
- package/src/dates/format.ts +0 -106
- package/src/dates/index.ts +0 -9
- package/src/dates/parse.ts +0 -24
- package/src/dates/period.ts +0 -23
- package/src/dates/shift.ts +0 -90
- package/src/dates/types.ts +0 -32
- package/src/dates/yearDate.ts +0 -36
- package/src/fields/__tests__/fields.update.test.ts +0 -73
- package/src/fields/filter.ts +0 -27
- package/src/fields/index.ts +0 -4
- package/src/fields/transfer.ts +0 -85
- package/src/fields/update.ts +0 -124
- package/src/functions/assert.ts +0 -19
- package/src/functions/disposer.ts +0 -97
- package/src/functions/safeCall.ts +0 -6
- package/src/functions/throttle.ts +0 -96
- package/src/lazy/__tests__/lazy.test.ts +0 -48
- package/src/lazy/light.ts +0 -29
- package/src/lazy/promise.ts +0 -52
- package/src/lazy/singleton.ts +0 -32
- package/src/logger/__tests__/logger.test.ts +0 -206
- package/src/logger/abstractions.ts +0 -13
- package/src/logger/batch.ts +0 -9
- package/src/logger/console.ts +0 -52
- package/src/logger/file.ts +0 -66
- package/src/logger/index.ts +0 -71
- package/src/logger/named.ts +0 -47
- package/src/logger/proxy.ts +0 -29
- package/src/math/__tests__/arrays.test.ts +0 -196
- package/src/math/__tests__/calc.test.ts +0 -67
- package/src/math/__tests__/distribution.test.ts +0 -25
- package/src/math/__tests__/index.test.ts +0 -20
- package/src/math/arrays.ts +0 -274
- package/src/math/calc.ts +0 -69
- package/src/math/distribution.ts +0 -20
- package/src/math/index.ts +0 -27
- package/src/models/EntityWithStatus.ts +0 -58
- package/src/models/File.ts +0 -14
- package/src/observing/event.ts +0 -91
- package/src/observing/progressTracker.ts +0 -90
- package/src/observing/throttledEvent.ts +0 -20
- package/src/observing/timer.ts +0 -40
- package/src/storage/abstractions.ts +0 -18
- package/src/storage/asyncWrapper.ts +0 -24
- package/src/storage/index.ts +0 -2
- package/src/storage/keyStorage.ts +0 -40
- package/src/structures/__tests__/enumHelper.test.ts +0 -85
- package/src/structures/__tests__/tempoCache.test.ts +0 -31
- package/src/structures/helpers/enum.ts +0 -123
- package/src/structures/helpers/name.ts +0 -58
- package/src/structures/linkedList.ts +0 -129
- package/src/structures/pool.ts +0 -47
- package/src/structures/queue/__tests__/parallel.test.ts +0 -58
- package/src/structures/queue/__tests__/tasks.test.ts +0 -87
- package/src/structures/queue/parallel.ts +0 -142
- package/src/structures/queue/tasks.ts +0 -91
- package/src/structures/tempoCache.ts +0 -18
- package/src/types/comparator.ts +0 -6
- package/src/types/deep.ts +0 -18
- package/src/types/functions.ts +0 -8
- package/src/types/getter.ts +0 -14
- package/src/types/ident.ts +0 -8
- package/src/types/index.ts +0 -17
- package/src/validation/ValidationErrors.ts +0 -26
- package/src/validation/__tests__/index.test.ts +0 -8
- package/src/validation/__tests__/validator.test.ts +0 -107
- package/src/validation/creditCard.ts +0 -25
- package/src/validation/emails.ts +0 -5
- package/src/validation/helpers.ts +0 -47
- package/src/validation/index.ts +0 -9
- package/src/validation/types.ts +0 -18
- package/src/validation/validators.ts +0 -55
- package/src/validation/wrappers.ts +0 -26
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -32
- package/yarn-error.log +0 -3709
- package/yarn.lock +0 -3446
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as calc from '../calc';
|
|
2
|
-
|
|
3
|
-
describe('math/calc', () => {
|
|
4
|
-
it('clamp', () => {
|
|
5
|
-
expect(calc.clamp(123)).toBe(123);
|
|
6
|
-
expect(calc.clamp(123, 10)).toBe(123);
|
|
7
|
-
expect(calc.clamp(0, 1, 2, false)).toBe(1);
|
|
8
|
-
expect(calc.clamp(0, 1, 2, true)).toBe(2);
|
|
9
|
-
expect(calc.clamp(3, 1, 2, false)).toBe(2);
|
|
10
|
-
expect(calc.clamp(3, 1, 2, true)).toBe(1);
|
|
11
|
-
expect(calc.clamp(15, 10, 20, false)).toBe(15);
|
|
12
|
-
expect(calc.clamp(15, 10, 20, true)).toBe(15);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('clamp01', () => {
|
|
16
|
-
expect(calc.clamp01(-1)).toBe(0);
|
|
17
|
-
expect(calc.clamp01(0)).toBe(0);
|
|
18
|
-
expect(calc.clamp01(0.5)).toBe(0.5);
|
|
19
|
-
expect(calc.clamp01(1)).toBe(1);
|
|
20
|
-
expect(calc.clamp01(2)).toBe(1);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('contains', () => {
|
|
24
|
-
expect(calc.contains(1, 2, 3)).toBe(false);
|
|
25
|
-
expect(calc.contains(1, 3, 2)).toBe(false);
|
|
26
|
-
expect(calc.contains(15, 10, 20)).toBe(true);
|
|
27
|
-
expect(calc.contains(15, 20, 10)).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('getIntersection', () => {
|
|
31
|
-
expect(calc.getIntersection(1, 2, 3, 4)).toBeFalsy();
|
|
32
|
-
expect(calc.getIntersection(1, 3, 1, 4)).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('roundNumber', () => {
|
|
36
|
-
expect(calc.roundNumber(10)).toBe(10);
|
|
37
|
-
expect(calc.roundNumber(10.1)).toBe(10.1);
|
|
38
|
-
expect(calc.roundNumber(10.12)).toBe(10.12);
|
|
39
|
-
expect(calc.roundNumber(10.123)).toBe(10.12);
|
|
40
|
-
expect(calc.roundNumber(10.1234)).toBe(10.12);
|
|
41
|
-
expect(calc.roundNumber(10.1234, 4)).toBe(10.1234);
|
|
42
|
-
expect(calc.roundNumber(10.1235, 3)).toBe(10.124);
|
|
43
|
-
expect(calc.roundNumber(10.1234, 3, 'ceil')).toBe(10.124);
|
|
44
|
-
expect(calc.roundNumber(10.1239, 3, 'floor')).toBe(10.123);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('roundHalf', () => {
|
|
48
|
-
expect(calc.roundHalf(12.213)).toBe(12);
|
|
49
|
-
expect(calc.roundHalf(12.999)).toBe(13);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('random', () => {
|
|
53
|
-
const testRandom = (min: number, max: number, trunc = true) => {
|
|
54
|
-
it(`[${min}, ${max}, ${trunc}]`, () => {
|
|
55
|
-
const v = calc.random(min, max, trunc);
|
|
56
|
-
expect(v).toBeGreaterThanOrEqual(min);
|
|
57
|
-
expect(v).toBeLessThanOrEqual(max);
|
|
58
|
-
expect(v - Math.trunc(v) > 0).not.toEqual(trunc);
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
testRandom(0, 1, true);
|
|
63
|
-
testRandom(0, 1, false);
|
|
64
|
-
testRandom(1, 100, true);
|
|
65
|
-
testRandom(1, 100, false);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as distribution from '../distribution';
|
|
2
|
-
|
|
3
|
-
describe('math/distribution', () => {
|
|
4
|
-
it('extendDistribution', () => {
|
|
5
|
-
type TKeys = 'type1' | 'type2';
|
|
6
|
-
|
|
7
|
-
const r1 = distribution.extendDistribution<TKeys>(1, 'type1');
|
|
8
|
-
expect(r1).toBeTruthy();
|
|
9
|
-
expect(r1.total).toBe(1);
|
|
10
|
-
expect(r1.byType.type1).toBe(1);
|
|
11
|
-
|
|
12
|
-
distribution.extendDistribution(3, 'type2', r1);
|
|
13
|
-
expect(r1.total).toBe(4);
|
|
14
|
-
expect(r1.byType.type1).toBe(1);
|
|
15
|
-
expect(r1.byType.type2).toBe(3);
|
|
16
|
-
|
|
17
|
-
const d: distribution.Distribution<TKeys> = { total: 0, byType: null };
|
|
18
|
-
distribution.extendDistribution(1, 'type1', d);
|
|
19
|
-
expect(d.total).toBe(1);
|
|
20
|
-
expect(d.byType.type1).toBe(1);
|
|
21
|
-
expect(d.byType.type2).toBeUndefined();
|
|
22
|
-
|
|
23
|
-
expect(distribution.extendDistribution(0, 'type1').total).toBe(0);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as math from '../index';
|
|
2
|
-
|
|
3
|
-
describe('math', () => {
|
|
4
|
-
it('getNumberSuffix', () => {
|
|
5
|
-
expect(math.getNumberSuffix(1)).toBe('st');
|
|
6
|
-
expect(math.getNumberSuffix(11)).toBe('st');
|
|
7
|
-
expect(math.getNumberSuffix(11111)).toBe('st');
|
|
8
|
-
|
|
9
|
-
expect(math.getNumberSuffix(2)).toBe('nd');
|
|
10
|
-
expect(math.getNumberSuffix(1232)).toBe('nd');
|
|
11
|
-
expect(math.getNumberSuffix(32412.99)).toBe('th');
|
|
12
|
-
|
|
13
|
-
expect(math.getNumberSuffix(3)).toBe('rd');
|
|
14
|
-
expect(math.getNumberSuffix(323)).toBe('rd');
|
|
15
|
-
expect(math.getNumberSuffix(1233.233)).toBe('th');
|
|
16
|
-
|
|
17
|
-
expect(math.getNumberSuffix(0)).toBe('th');
|
|
18
|
-
expect(math.getNumberSuffix(145)).toBe('th');
|
|
19
|
-
});
|
|
20
|
-
});
|
package/src/math/arrays.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { Comparator, Getter, Predicate } from '../types';
|
|
2
|
-
import { random } from './calc';
|
|
3
|
-
|
|
4
|
-
export function arrayCompareG<T>(arr: ReadonlyArray<T>, cond: (current: T, previous: T) => boolean): T {
|
|
5
|
-
if (!Array.isArray(arr) || arr.length <= 0) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
let result: T = null;
|
|
10
|
-
for (let i = 0; i < arr.length; i++) {
|
|
11
|
-
const current: T = arr[i];
|
|
12
|
-
if (cond(current, result)) {
|
|
13
|
-
result = current;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function arrayCompare(arr: number[], absolute: boolean, cond: (i: number, t: number) => boolean) {
|
|
21
|
-
if (!Array.isArray(arr) || arr.length <= 0) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let max = arr[0];
|
|
26
|
-
for (let i = 1; i < arr.length; i++) {
|
|
27
|
-
const e = absolute ? Math.abs(arr[i]) : arr[i];
|
|
28
|
-
if (cond(e, max)) {
|
|
29
|
-
max = e;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return max;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function arrayMax(arr: number[], absolute = false) {
|
|
37
|
-
return arrayCompare(arr, absolute, (e, max) => e > max);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function arrayMin(arr: number[], absolute = false) {
|
|
41
|
-
return arrayCompare(arr, absolute, (e, min) => e < min);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function arrayAverage(arr: number[], absolute = false) {
|
|
45
|
-
if (!Array.isArray(arr) || arr.length <= 0) {
|
|
46
|
-
return 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let sum = 0;
|
|
50
|
-
for (let i = 0; i < arr.length; i++) {
|
|
51
|
-
const e = absolute ? Math.abs(arr[i]) : arr[i];
|
|
52
|
-
sum += e;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return sum / arr.length;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function arrayCount<T>(arr: ReadonlyArray<T>, condition: (o: T) => boolean): number {
|
|
59
|
-
if (!arr || !arr.length) {
|
|
60
|
-
return 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let count = 0;
|
|
64
|
-
arr.forEach(a => {
|
|
65
|
-
if (condition(a)) {
|
|
66
|
-
++count;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return count;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function arrayFirstResult<T, V>(arr: ReadonlyArray<T>, mapper: (o: T) => V | null | false): V | null | false {
|
|
73
|
-
if (arr?.length) {
|
|
74
|
-
for (let i = 0; i < arr.length; ++i) {
|
|
75
|
-
const r = mapper(arr[i]);
|
|
76
|
-
if (r) {
|
|
77
|
-
return r;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function arraysCompare<T>(base: readonly T[], target: readonly T[], comparator?: Comparator<T>) {
|
|
86
|
-
if (!base || !target) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const compare = comparator || Comparator.Default;
|
|
91
|
-
const result = {
|
|
92
|
-
missing: [] as T[],
|
|
93
|
-
extra: [] as T[],
|
|
94
|
-
diff: 0,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
for (let i = 0; i < base.length; ++i) {
|
|
98
|
-
const baseItem = base[i];
|
|
99
|
-
const targetItem = target[i];
|
|
100
|
-
if (compare(baseItem, targetItem)) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
result.missing.push(baseItem);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
for (let i = base.length; i < target.length; ++i) {
|
|
108
|
-
result.extra.push(target[i]);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
result.diff = result.missing.length + result.extra.length;
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function arraysCompareDistinct<T>(base: readonly T[], target: readonly T[]) {
|
|
116
|
-
if (!base || !target) {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const baseSet = new Set(base);
|
|
121
|
-
const targetSet = new Set(target);
|
|
122
|
-
const result = {
|
|
123
|
-
missing: [] as T[],
|
|
124
|
-
extra: [] as T[],
|
|
125
|
-
diff: 0,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
for (const item of baseSet) {
|
|
129
|
-
if (!targetSet.has(item)) {
|
|
130
|
-
result.missing.push(item);
|
|
131
|
-
} else {
|
|
132
|
-
// reduce iterations for 'extra'
|
|
133
|
-
targetSet.delete(item);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
for (const item of targetSet) {
|
|
138
|
-
// all items left in 'target' is missing in 'base'
|
|
139
|
-
result.extra.push(item);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
result.diff = result.missing.length + result.extra.length;
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function arrayDistinct<T>(arr: readonly T[]) {
|
|
147
|
-
return Array.from(new Set(arr || []));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function normalize(arr: number[]): number[] {
|
|
151
|
-
if (arr.length === 0) {
|
|
152
|
-
return arr;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const min = arrayMin(arr);
|
|
156
|
-
const max = arrayMax(arr);
|
|
157
|
-
const dist = max - min;
|
|
158
|
-
if (Math.abs(dist) < 0.000001) { // almost zero
|
|
159
|
-
return arr.map(() => 1);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return arr.map(x => (x - min) / dist);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export function randomArrayItem<T>(arr: T[]): T {
|
|
166
|
-
if (!arr.length) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const i = random(0, arr.length - 1);
|
|
171
|
-
return arr[i];
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export function arraySwap<T>(arr: T[], i1: number, i2: number) {
|
|
175
|
-
const x = arr[i1];
|
|
176
|
-
arr[i1] = arr[i2];
|
|
177
|
-
arr[i2] = x;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export function shuffle<T>(arr: T[], slice: false): T[];
|
|
181
|
-
export function shuffle<T>(arr: ReadonlyArray<T>): T[];
|
|
182
|
-
export function shuffle<T>(arr: ReadonlyArray<T>, slice: true): T[];
|
|
183
|
-
|
|
184
|
-
export function shuffle<T>(arr: T[], slice = true): T[] {
|
|
185
|
-
const res = (slice ? arr?.slice() : arr) || [];
|
|
186
|
-
|
|
187
|
-
for (let i = 0; i < res.length - 1; ++i) {
|
|
188
|
-
const nextIndex = random(i + 1, res.length - 1);
|
|
189
|
-
arraySwap(res, i, nextIndex);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return res;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function groupBy<T, K extends string | number>(arr: ReadonlyArray<T>, grouper: (item: T) => K): Partial<Record<K, T[]>> {
|
|
196
|
-
const result: Partial<Record<K, T[]>> = { };
|
|
197
|
-
arr.forEach(item => {
|
|
198
|
-
const k = grouper(item);
|
|
199
|
-
let g = result[k];
|
|
200
|
-
if (!g) {
|
|
201
|
-
g = [];
|
|
202
|
-
result[k] = g;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
g.push(item);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export function groupOneBy<T, K extends string | number>(arr: ReadonlyArray<T>, grouper: (item: T) => K): Partial<Record<K, T>> {
|
|
212
|
-
const result: Partial<Record<K, T>> = { };
|
|
213
|
-
arr.forEach(item => {
|
|
214
|
-
const k = grouper(item);
|
|
215
|
-
result[k] = item;
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
return result;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export function arraySplit<T>(arr: ReadonlyArray<T>, predicate: (t: T) => boolean): [T[], T[]] {
|
|
222
|
-
const trueArr: T[] = [];
|
|
223
|
-
const falseArr: T[] = [];
|
|
224
|
-
|
|
225
|
-
arr.forEach(a => {
|
|
226
|
-
(predicate(a)
|
|
227
|
-
? trueArr
|
|
228
|
-
: falseArr).push(a);
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return [trueArr, falseArr];
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export function findIndexLeast(num: number, arr: number[], sort = false) {
|
|
235
|
-
if (sort) {
|
|
236
|
-
arr.sort();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return arr.findIndex(i => i > num);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
type NonFunction<T> = T extends Function ? never : T;
|
|
243
|
-
|
|
244
|
-
export function removeItem<T>(array: T[], item: NonFunction<T> | Predicate<T>): T {
|
|
245
|
-
const index = typeof item === 'function'
|
|
246
|
-
? array.findIndex(item as Predicate<T>)
|
|
247
|
-
: array.indexOf(item);
|
|
248
|
-
if (index < 0) {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return array.splice(index, 1)[0];
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export function arrayRepeat<T>(factory: Getter<T>, count = 1) {
|
|
256
|
-
const res: T[] = [];
|
|
257
|
-
for (let i = 0; i < count; ++i) {
|
|
258
|
-
res.push(Getter.getValue(factory));
|
|
259
|
-
}
|
|
260
|
-
return res;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export function chunkify<T>(array: T[], size: number): T[][] {
|
|
264
|
-
return array.reduce((res, item) => {
|
|
265
|
-
let arr = res[res.length - 1];
|
|
266
|
-
if (!arr || arr.length >= size) {
|
|
267
|
-
arr = [];
|
|
268
|
-
res.push(arr);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
arr.push(item);
|
|
272
|
-
return res;
|
|
273
|
-
}, [] as T[][]);
|
|
274
|
-
}
|
package/src/math/calc.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export function clamp(val: number, min: number = undefined, max: number = undefined, cycle = false) {
|
|
3
|
-
if (min != null && val < min) {
|
|
4
|
-
return (max != null && cycle) ? max : min;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
if (max != null && val > max) {
|
|
8
|
-
return (min != null && cycle) ? min : max;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return val;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function clamp01(val: number) {
|
|
15
|
-
return clamp(val, 0, 1, false);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function contains(val: number, from: number, to: number) {
|
|
19
|
-
const s = Math.min(from, to);
|
|
20
|
-
const e = Math.max(from, to);
|
|
21
|
-
return val >= s && val <= e;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function getIntersection(v1: number, v2: number, r1: number, r2: number): false | { ranges: number[][], merged: { s: number, e: number} } {
|
|
25
|
-
const v = [v1, v2].sort();
|
|
26
|
-
const r = [r1, r2].sort();
|
|
27
|
-
|
|
28
|
-
const res = (v[0] >= r[0] && v[0] <= r[1])
|
|
29
|
-
|| (v[1] >= r[0] && v[1] <= r[1])
|
|
30
|
-
|| (r[0] >= v[0] && r[0] <= v[1])
|
|
31
|
-
|| (r[1] >= v[0] && r[1] <= v[1]);
|
|
32
|
-
|
|
33
|
-
if (!res) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
ranges: [v, r],
|
|
39
|
-
merged: {
|
|
40
|
-
s: Math.min(v[0], r[0]),
|
|
41
|
-
e: Math.max(v[1], r[1]),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function roundNumber(val: number, signs = 2, mode?: 'floor' | 'ceil') {
|
|
47
|
-
const k = 10 ** signs;
|
|
48
|
-
let v = (val + Number.EPSILON) * k;
|
|
49
|
-
switch (mode) {
|
|
50
|
-
case 'floor': v = Math.floor(v); break;
|
|
51
|
-
case 'ceil': v = Math.ceil(v); break;
|
|
52
|
-
default: v = Math.round(v); break;
|
|
53
|
-
}
|
|
54
|
-
return v / k;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function roundHalf(num: number): number {
|
|
58
|
-
return Math.round(num * 2) / 2;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function random(min: number = 0, max: number = 1, trunc = true) {
|
|
62
|
-
const r = Math.random();
|
|
63
|
-
const res = min + r * (max - min);
|
|
64
|
-
return trunc ? Math.trunc(res) : res;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function badRandomString(length = 12) {
|
|
68
|
-
return Math.random().toString(26).slice(2, clamp(length, 0, 12));
|
|
69
|
-
}
|
package/src/math/distribution.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type Distribution<T extends keyof any> = {
|
|
4
|
-
total: number,
|
|
5
|
-
byType: Partial<Record<T, number>>,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function extendDistribution<T extends keyof any>(count: number, type: T, current?: Distribution<T>): Distribution<T> {
|
|
9
|
-
const res: Distribution<T> = current ?? { total: 0, byType: { } };
|
|
10
|
-
if (!res.byType) {
|
|
11
|
-
res.byType = { };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (count > 0) {
|
|
15
|
-
res.byType[type] = (res.byType[type] || 0) + count;
|
|
16
|
-
res.total += count;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return res;
|
|
20
|
-
}
|
package/src/math/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './calc';
|
|
3
|
-
export * from './arrays';
|
|
4
|
-
export * from './distribution';
|
|
5
|
-
|
|
6
|
-
export function getNumberSuffix(num: number) {
|
|
7
|
-
const lastDigit = (num || 0) % 10;
|
|
8
|
-
|
|
9
|
-
switch (lastDigit) {
|
|
10
|
-
case 1:
|
|
11
|
-
return 'st';
|
|
12
|
-
case 2:
|
|
13
|
-
return 'nd';
|
|
14
|
-
case 3:
|
|
15
|
-
return 'rd';
|
|
16
|
-
default:
|
|
17
|
-
return 'th';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function format(n: number, digits?: number) {
|
|
22
|
-
const res = n.toString();
|
|
23
|
-
if (digits && digits > res.length) {
|
|
24
|
-
return res.padStart(digits, '0');
|
|
25
|
-
}
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export type StatusWithDate<TStatus extends string = string> = {
|
|
2
|
-
status: TStatus,
|
|
3
|
-
date: number,
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export type EntityWithStatus<TStatus extends string> = StatusWithDate<TStatus> & {
|
|
7
|
-
history?: { d: number, s: TStatus }[],
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export namespace EntityWithStatus {
|
|
11
|
-
|
|
12
|
-
export function changeStatus<T extends EntityWithStatus<TStatus>, TStatus extends string>(entity: Partial<T>, status: TStatus, date: number = null, allowStatusUpdate = false) {
|
|
13
|
-
if (!entity) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (entity.status === status && !allowStatusUpdate) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!entity.history) {
|
|
22
|
-
entity.history = [];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
entity.history.push({ d: entity.date || null, s: entity.status || null });
|
|
26
|
-
entity.date = date || Date.now();
|
|
27
|
-
entity.status = status;
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getLastStatusDate<T extends EntityWithStatus<TStatus>, TStatus extends string>(entity: T, ...statuses: TStatus[]) {
|
|
32
|
-
if (!entity || !statuses.length) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (statuses.includes(entity.status)) {
|
|
37
|
-
return entity.date;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (entity.history && entity.history.length) {
|
|
41
|
-
const t = entity.history.find(h => statuses.includes(h.s));
|
|
42
|
-
if (t) {
|
|
43
|
-
return t.d;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function getFullHistory<T extends EntityWithStatus<TStatus>, TStatus extends string>(entity: T): StatusWithDate<TStatus>[] {
|
|
51
|
-
const result: { date: number, status: TStatus }[] = [];
|
|
52
|
-
if (entity.history?.length) {
|
|
53
|
-
result.push(...entity.history.map(h => ({ date: h.d, status: h.s })));
|
|
54
|
-
}
|
|
55
|
-
result.push({ date: entity.date, status: entity.status });
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
|
-
}
|
package/src/models/File.ts
DELETED
package/src/observing/event.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { Predicate } from '../types';
|
|
2
|
-
import { forEachAsync } from '../async/arrays';
|
|
3
|
-
import { ILogger, createLogger } from '../logger';
|
|
4
|
-
|
|
5
|
-
export type EventHandler<T = any> = (data?: T) => void | Promise<void>;
|
|
6
|
-
|
|
7
|
-
export interface IEvent<T = any> {
|
|
8
|
-
on(handler: EventHandler<T>): () => void;
|
|
9
|
-
off(handler: EventHandler<T>): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class Event<T = any> implements IEvent<T> {
|
|
13
|
-
private _handlers: EventHandler<T>[] = [];
|
|
14
|
-
private _logger: ILogger = null;
|
|
15
|
-
|
|
16
|
-
constructor();
|
|
17
|
-
constructor(logger?: ILogger);
|
|
18
|
-
constructor(name?: string);
|
|
19
|
-
|
|
20
|
-
constructor(loggerOrName?: ILogger | string) {
|
|
21
|
-
this._logger = (!loggerOrName || typeof loggerOrName === 'string')
|
|
22
|
-
? createLogger(`[Event:${loggerOrName || '?'}]`)
|
|
23
|
-
: loggerOrName;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public on(handler: EventHandler<T>): () => void {
|
|
27
|
-
this._handlers.push(handler);
|
|
28
|
-
return () => {
|
|
29
|
-
this.off(handler);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public off(handler: EventHandler<T>): void {
|
|
34
|
-
this._handlers = this._handlers.filter(h => h !== handler);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public trigger(data?: T) {
|
|
38
|
-
if (!this._handlers.length) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const hh = this._handlers.slice(0);
|
|
43
|
-
hh.forEach(cb => {
|
|
44
|
-
try {
|
|
45
|
-
cb(data);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
this.logError(data, cb, err);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public async triggerAsync(data?: T): Promise<Error[]> {
|
|
53
|
-
if (!this._handlers.length) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const hh = this._handlers.slice(0);
|
|
58
|
-
|
|
59
|
-
const errors: Error[] = [];
|
|
60
|
-
|
|
61
|
-
await forEachAsync(hh, async (cb: EventHandler<T>) => {
|
|
62
|
-
try {
|
|
63
|
-
await cb(data);
|
|
64
|
-
} catch (err) {
|
|
65
|
-
this.logError(data, cb, err);
|
|
66
|
-
errors.push(err);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return errors;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public expose(): IEvent<T> {
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private logError(data: T, cb: EventHandler<T>, err: Error) {
|
|
78
|
-
this._logger.error(`[Event.${typeof data}] Handler ${cb.name} thrown an exception: `, err);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function oneTimeSubscription<T>(e: IEvent<T>, filter?: Predicate<T>): Promise<T> {
|
|
83
|
-
return new Promise<T>((resolve) => {
|
|
84
|
-
const unsub = e.on(v => {
|
|
85
|
-
if (!filter || filter(v)) {
|
|
86
|
-
unsub();
|
|
87
|
-
resolve(v);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|