@zajno/common 2.0.2 → 2.0.4
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/{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/async/misc.d.ts +8 -0
- package/{lib/async → async}/misc.d.ts.map +1 -1
- package/async/misc.js +27 -0
- package/async/misc.js.map +1 -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 +1 -1
- package/{lib/logger → logger}/index.js +1 -1
- package/logger/index.js.map +1 -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/{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 -9
- 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 +0 -0
- package/{lib/types → types}/getter.js +0 -0
- package/{lib/types → types}/getter.js.map +0 -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/types/models.d.ts +19 -0
- package/types/models.d.ts.map +1 -0
- package/types/models.js +3 -0
- package/types/models.js.map +1 -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 -2765
- package/global-test-setup.js +0 -3
- package/jest.config.js +0 -10
- package/lib/async/misc.d.ts +0 -3
- package/lib/async/misc.js +0 -13
- package/lib/async/misc.js.map +0 -1
- package/lib/logger/index.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 -11
- 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
package/src/dates/calc.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { getTime } from './parse';
|
|
2
|
-
import { endOf, startOf } from './shift';
|
|
3
|
-
import { Granularity } from './types';
|
|
4
|
-
|
|
5
|
-
export function contains(start: Date | number, end: Date | number, target: Date | number, granularity: Granularity = 'second') {
|
|
6
|
-
const t = getTime(target);
|
|
7
|
-
|
|
8
|
-
const ss = startOf(start, granularity);
|
|
9
|
-
const ee = endOf(end, granularity);
|
|
10
|
-
|
|
11
|
-
return ss.getTime() <= t
|
|
12
|
-
&& t <= ee.getTime();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function intersects(start1: Date | number, end1: Date | number, start2: Date | number, end2: Date | number, granularity: Granularity = 'millisecond') {
|
|
16
|
-
const s = startOf(start1, granularity).getTime(),
|
|
17
|
-
e = endOf(end1, granularity).getTime(),
|
|
18
|
-
ss = startOf(start2, granularity).getTime(),
|
|
19
|
-
ee = endOf(end2, granularity).getTime();
|
|
20
|
-
|
|
21
|
-
return (ss >= s && ss <= e)
|
|
22
|
-
|| (ee >= s && ee <= e)
|
|
23
|
-
|| (s >= ss && s <= ee)
|
|
24
|
-
|| (e >= ss && e <= ee);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function countDays(start: Date, end: Date, condition: (d: Date) => boolean) {
|
|
28
|
-
let count = 0;
|
|
29
|
-
|
|
30
|
-
const current = new Date(start.getTime());
|
|
31
|
-
do {
|
|
32
|
-
if (!condition || condition(current)) {
|
|
33
|
-
++count;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
current.setUTCDate(current.getUTCDate() + 1);
|
|
37
|
-
} while (current.getTime() <= end.getTime());
|
|
38
|
-
|
|
39
|
-
return count;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function compare(d1: Date | number, d2: Date | number, g: Granularity, local?: boolean): number;
|
|
43
|
-
export function compare(d1: Date | number, d2: Date | number): number;
|
|
44
|
-
|
|
45
|
-
export function compare(d1: Date | number, d2: Date | number, g: Granularity = null, local = false) {
|
|
46
|
-
const s1 = g ? startOf(d1, g, local) : d1;
|
|
47
|
-
const s2 = g ? startOf(d2, g, local) : d2;
|
|
48
|
-
return getTime(s1) - getTime(s2);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function min(d1: Date, d2: Date): Date {
|
|
52
|
-
const c = compare(d1, d2);
|
|
53
|
-
return c < 0 ? d1 : d2;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function max(d1: Date, d2: Date): Date {
|
|
57
|
-
const c = compare(d1, d2);
|
|
58
|
-
return c >= 0 ? d1 : d2;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function clamp(d: Date, low: Date, high: Date) {
|
|
62
|
-
const dt = d.getTime();
|
|
63
|
-
const mint = low.getTime();
|
|
64
|
-
const maxt = high.getTime();
|
|
65
|
-
if (dt < mint) {
|
|
66
|
-
return low;
|
|
67
|
-
}
|
|
68
|
-
if (dt > maxt) {
|
|
69
|
-
return high;
|
|
70
|
-
}
|
|
71
|
-
return d;
|
|
72
|
-
}
|
package/src/dates/convert.ts
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { DateX } from './datex';
|
|
2
|
-
import { getDate, getTime } from './parse';
|
|
3
|
-
import { isSame, startOf } from './shift';
|
|
4
|
-
import { ConstantGranularity, Granularity } from './types';
|
|
5
|
-
|
|
6
|
-
type DateFields<T> = {
|
|
7
|
-
[P in keyof T]: T[P] extends Date ? P : never;
|
|
8
|
-
}[keyof T];
|
|
9
|
-
|
|
10
|
-
export function ensureDates<T>(obj: T, ...fields: DateFields<T>[]) {
|
|
11
|
-
if (obj) {
|
|
12
|
-
fields.forEach(f => {
|
|
13
|
-
if (obj[f]) {
|
|
14
|
-
obj[f] = getDate(obj[f] as any) as any;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function isNetworkDay(n: number) { return n >= 1 && n <= 5; }
|
|
21
|
-
export function isNetworkDate(d: Date) { return isNetworkDay(d.getUTCDay()); }
|
|
22
|
-
|
|
23
|
-
export function convert(amount: number, g: ConstantGranularity, to: ConstantGranularity) {
|
|
24
|
-
const ms = amount * ConstantGranularity.toMs(g);
|
|
25
|
-
const toMs = ConstantGranularity.toMs(to);
|
|
26
|
-
return ms / toMs;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function unix(d: Date | number) {
|
|
30
|
-
return Math.floor(getTime(d) / 1000);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function unixDayIndex(d: Date | number) {
|
|
34
|
-
return Math.floor(getTime(d) / (1000 * 3600 * 24));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function dateFromUnixDayIndex(d: number) {
|
|
38
|
-
return new Date(d * 1000 * 3600 * 24);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function decompose(date: number | Date, local: boolean, ...grans: Granularity[]): Partial<Record<Granularity, number>> {
|
|
42
|
-
const dd = getDate(date);
|
|
43
|
-
const offset = local ? dd.getTimezoneOffset() * 60000 : 0;
|
|
44
|
-
const ms = dd.getTime() + offset;
|
|
45
|
-
|
|
46
|
-
return decomposeMs(ms, ...grans);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function decomposeMs<K extends Granularity>(ms: number, ...grans: K[]): Record<K, number> {
|
|
50
|
-
const res: Partial<Record<Granularity, number>> = {};
|
|
51
|
-
|
|
52
|
-
// absolute vals
|
|
53
|
-
let secs = Math.round(ms / 1000);
|
|
54
|
-
let mins = Math.trunc(secs / 60);
|
|
55
|
-
let hrs = Math.trunc(mins / 60);
|
|
56
|
-
const days = Math.trunc(hrs / 24);
|
|
57
|
-
|
|
58
|
-
// apply only selected granularities
|
|
59
|
-
if (grans.includes('day' as K)) {
|
|
60
|
-
hrs = hrs % 24;
|
|
61
|
-
res.day = days;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (grans.includes('hour' as K)) {
|
|
65
|
-
mins = mins % 60;
|
|
66
|
-
res.hour = hrs;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (grans.includes('minute' as K)) {
|
|
70
|
-
secs = secs % 60;
|
|
71
|
-
res.minute = mins;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (grans.includes('second' as K)) {
|
|
75
|
-
res.second = secs;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return res;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function decomposeDate<K extends Granularity>(d: Date, local: boolean, ...grans: K[]): Record<K, number> {
|
|
82
|
-
const res: Partial<Record<Granularity, number>> = {};
|
|
83
|
-
grans.forEach(g => {
|
|
84
|
-
if (g !== 'week') {
|
|
85
|
-
const diff = g === 'month' ? 1 : 0;
|
|
86
|
-
res[g] = DateX.get(d, g, local) + diff;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
return res;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export function splitDatesByDay(dates: number[]): number[][] {
|
|
94
|
-
if (!dates) {
|
|
95
|
-
return [];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const res: number[][] = [];
|
|
99
|
-
let currentDate: number;
|
|
100
|
-
let tmpArr: number[];
|
|
101
|
-
|
|
102
|
-
const datesCopy = [...dates];
|
|
103
|
-
|
|
104
|
-
datesCopy
|
|
105
|
-
.sort()
|
|
106
|
-
.forEach(date => {
|
|
107
|
-
if (!currentDate) {
|
|
108
|
-
currentDate = new Date(date).getTime();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!tmpArr) {
|
|
112
|
-
tmpArr = [];
|
|
113
|
-
res.push(tmpArr);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (isSame(date, currentDate, 'day', true)) {
|
|
117
|
-
tmpArr.push(currentDate);
|
|
118
|
-
} else {
|
|
119
|
-
currentDate = new Date(date).getTime();
|
|
120
|
-
tmpArr = [date];
|
|
121
|
-
res.push(tmpArr);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
return res;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function getDiscreteDiff(d1: number | Date, d2: number | Date, granularity: Granularity, local = false, absolute = true) {
|
|
129
|
-
let v1: number, v2: number;
|
|
130
|
-
|
|
131
|
-
switch (granularity) {
|
|
132
|
-
case 'year': {
|
|
133
|
-
const dd1 = getDate(d1);
|
|
134
|
-
const dd2 = getDate(d2);
|
|
135
|
-
v1 = local ? dd1.getFullYear() : dd1.getUTCFullYear();
|
|
136
|
-
v2 = local ? dd2.getFullYear() : dd2.getUTCFullYear();
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
case 'month': {
|
|
141
|
-
const dd1 = getDate(d1);
|
|
142
|
-
const dd2 = getDate(d2);
|
|
143
|
-
v1 = local ? dd1.getMonth() : dd1.getUTCMonth();
|
|
144
|
-
v2 = local ? dd2.getMonth() : dd2.getUTCMonth();
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
default: {
|
|
149
|
-
const ms = ConstantGranularity.toMs(granularity);
|
|
150
|
-
v1 = startOf(d1, granularity, local).getTime() / ms;
|
|
151
|
-
v2 = startOf(d2, granularity, local).getTime() / ms;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
let diff = v2 - v1;
|
|
157
|
-
if (absolute) {
|
|
158
|
-
diff = Math.abs(diff);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return Math.round(diff);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function getDaysStreak(dates: number[], descentOrder: boolean): number {
|
|
165
|
-
let streak = 0;
|
|
166
|
-
let d = dates;
|
|
167
|
-
let dayToCompare = Date.now();
|
|
168
|
-
|
|
169
|
-
if (descentOrder) {
|
|
170
|
-
d = dates.slice().sort().reverse();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
for (let i = 0; i < d.length; i++) {
|
|
174
|
-
const diff = getDiscreteDiff(dayToCompare, d[i], 'day', true);
|
|
175
|
-
|
|
176
|
-
if (diff >= 2) {
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
if (diff === 0 && streak === 0) {
|
|
180
|
-
streak = 1;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
streak += diff;
|
|
184
|
-
|
|
185
|
-
if (diff > 0) {
|
|
186
|
-
dayToCompare = d[i];
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return streak > 1 ? streak : 0;
|
|
191
|
-
}
|
package/src/dates/datex.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Granularity } from './types';
|
|
2
|
-
|
|
3
|
-
export namespace DateX {
|
|
4
|
-
export function get(d: Date, g: Granularity, local: boolean) {
|
|
5
|
-
switch (g) {
|
|
6
|
-
case 'year': return local ? d.getFullYear() : d.getUTCFullYear();
|
|
7
|
-
case 'month': return local ? d.getMonth() : d.getUTCMonth();
|
|
8
|
-
case 'week': throw new Error('Not supported');
|
|
9
|
-
case 'day': return local ? d.getDate() : d.getUTCDate();
|
|
10
|
-
case 'hour': return local ? d.getHours() : d.getUTCHours();
|
|
11
|
-
case 'minute': return local ? d.getMinutes() : d.getUTCMinutes();
|
|
12
|
-
case 'second': return local ? d.getSeconds() : d.getUTCSeconds();
|
|
13
|
-
case 'millisecond': return local ? d.getMilliseconds() : d.getUTCMilliseconds();
|
|
14
|
-
default: return d.getTime();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function set(d: Date, g: 'year', local: boolean, year: number, month?: number, date?: number): number;
|
|
19
|
-
export function set(d: Date, g: 'month', local: boolean, month: number, date?: number): number;
|
|
20
|
-
export function set(d: Date, g: 'day', local: boolean, date: number): number;
|
|
21
|
-
export function set(d: Date, g: 'hour', local: boolean, hours: number, min?: number, sec?: number, ms?: number): number;
|
|
22
|
-
export function set(d: Date, g: 'minute', local: boolean, min: number, sec?: number, ms?: number): number;
|
|
23
|
-
export function set(d: Date, g: 'second', local: boolean, sec: number, ms?: number): number;
|
|
24
|
-
export function set(d: Date, g: 'millisecond', local: boolean, ms: number): number;
|
|
25
|
-
|
|
26
|
-
export function set(d: Date, g: Granularity, local: boolean, ...v: number[]) {
|
|
27
|
-
const fn: (...n: number[]) => number = (() => {
|
|
28
|
-
switch (g) {
|
|
29
|
-
case 'year': return local ? d.setFullYear : d.setUTCFullYear;
|
|
30
|
-
case 'month': return local ? d.setMonth : d.setUTCMonth;
|
|
31
|
-
case 'week': throw new Error('Not supported');
|
|
32
|
-
case 'day': return local ? d.setDate : d.setUTCDate;
|
|
33
|
-
case 'hour': return local ? d.setHours : d.setUTCHours;
|
|
34
|
-
case 'minute': return local ? d.setMinutes : d.setUTCMinutes;
|
|
35
|
-
case 'second': return local ? d.setSeconds : d.setUTCSeconds;
|
|
36
|
-
case 'millisecond': return local ? d.setMilliseconds : d.setUTCMilliseconds;
|
|
37
|
-
default: return null;
|
|
38
|
-
}
|
|
39
|
-
})();
|
|
40
|
-
return fn ? fn.call(d, ...v) : d.getTime();
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/dates/format.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import * as MathX from '../math';
|
|
2
|
-
import { decompose, decomposeDate, getDiscreteDiff } from './convert';
|
|
3
|
-
import { getDate, getTime } from './parse';
|
|
4
|
-
import { YearDate } from './yearDate';
|
|
5
|
-
|
|
6
|
-
export namespace Format {
|
|
7
|
-
|
|
8
|
-
export const DefaultLocale = 'en-US';
|
|
9
|
-
|
|
10
|
-
export enum Presets {
|
|
11
|
-
FullDay_ShortDate = 'ddd DD.MM.YYYY',
|
|
12
|
-
ShortDate_FullTime = 'DD.MM.YYYY HH:mm:ss',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export namespace Presets {
|
|
16
|
-
const fullDayShortDate = new Intl.DateTimeFormat(DefaultLocale, {
|
|
17
|
-
weekday: 'long',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export function use(p: Presets, d: Date, local = true) {
|
|
21
|
-
const dec = decomposeDate(d, local, 'year', 'month', 'day', 'hour', 'minute', 'second');
|
|
22
|
-
switch (p) {
|
|
23
|
-
case Presets.FullDay_ShortDate: {
|
|
24
|
-
const pts = fullDayShortDate.formatToParts(d);
|
|
25
|
-
const weekday = pts.find(t => t.type === 'weekday');
|
|
26
|
-
return `${weekday.value} ${MathX.format(dec.day, 2)}.${MathX.format(dec.month, 2)}.${MathX.format(dec.year)}`;
|
|
27
|
-
}
|
|
28
|
-
case Presets.ShortDate_FullTime: {
|
|
29
|
-
return `${MathX.format(dec.day, 2)}.${MathX.format(dec.month, 2)}.${dec.year} ${MathX.format(dec.hour, 2)}.${MathX.format(dec.minute, 2)}.${MathX.format(dec.second, 2)}`;
|
|
30
|
-
}
|
|
31
|
-
default: {
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function timespan(ms: Date | number, local = false): string {
|
|
40
|
-
const decs = decompose(getTime(ms), local, 'second', 'minute', 'hour');
|
|
41
|
-
|
|
42
|
-
const parts: string[] = [];
|
|
43
|
-
|
|
44
|
-
if (decs.hour) {
|
|
45
|
-
parts.push(`${decs.hour}h`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (decs.minute) {
|
|
49
|
-
parts.push(`${decs.minute}m`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
parts.push(`${decs.second}s`);
|
|
53
|
-
|
|
54
|
-
return parts.join(' ');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** `YYYY-MM-DD` */
|
|
58
|
-
export function toDatePicker(date: Date | number, local = false): string {
|
|
59
|
-
if (!date) return null;
|
|
60
|
-
const d = getDate(date);
|
|
61
|
-
const dd = decomposeDate(d, local, 'day', 'month', 'year');
|
|
62
|
-
return `${dd.year}-${MathX.format(dd.month, 2)}-${MathX.format(dd.day, 2)}`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function toLocalDate(date: Date | number): string {
|
|
66
|
-
if (!date) return null;
|
|
67
|
-
return getDate(date).toLocaleDateString(DefaultLocale);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function yearDate(yd: YearDate, short = false) {
|
|
71
|
-
const d = new Date(2020, yd?.month || 0, yd?.day || 1);
|
|
72
|
-
return d.toLocaleDateString(DefaultLocale, { month: short ? 'short' : 'long', day: 'numeric' });
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// TODO draft
|
|
76
|
-
export function toDistance(to: Date, from = new Date()) {
|
|
77
|
-
const now = from || new Date();
|
|
78
|
-
const isFuture = now.getTime() < to.getTime();
|
|
79
|
-
const days = getDiscreteDiff(to, now, 'day');
|
|
80
|
-
// console.log('toDistance days =', days);
|
|
81
|
-
if (days < 7) {
|
|
82
|
-
if (days < 1) {
|
|
83
|
-
return 'Today';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (days < 2) {
|
|
87
|
-
return isFuture ? 'Tomorrow' : 'Yesterday';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return isFuture
|
|
91
|
-
? `In ${Math.floor(days)} days`
|
|
92
|
-
: `${Math.floor(days)} days ago`;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const weeks = Math.floor(days / 7);
|
|
96
|
-
if (weeks < 2) {
|
|
97
|
-
return isFuture
|
|
98
|
-
? 'In a week'
|
|
99
|
-
: 'Week ago';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return isFuture
|
|
103
|
-
? `In ${weeks} weeks`
|
|
104
|
-
: `${weeks} weeks ago`;
|
|
105
|
-
}
|
|
106
|
-
}
|
package/src/dates/index.ts
DELETED
package/src/dates/parse.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export function getTime(d: Date | number): number {
|
|
3
|
-
return d instanceof Date ? d.getTime() : d;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function getDate(d: Date | number | string): Date {
|
|
7
|
-
if (!d) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return new Date(d);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export namespace Parse {
|
|
15
|
-
/** `YYYY-MM-DD` */
|
|
16
|
-
export function fromDatePicker(str: string, local = false) {
|
|
17
|
-
const result = new Date(str);
|
|
18
|
-
if (local) {
|
|
19
|
-
const offset = result.getTimezoneOffset() * 60000;
|
|
20
|
-
return new Date(result.getTime() + offset);
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/dates/period.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { add } from './shift';
|
|
2
|
-
import { Granularity } from './types';
|
|
3
|
-
|
|
4
|
-
export type Period = { amount: number, granularity: Granularity };
|
|
5
|
-
export namespace Period {
|
|
6
|
-
export function forward(period: Period, base: Date | number = new Date()): Date {
|
|
7
|
-
return add(base, period.amount, period.granularity);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function backward(period: Period, base: Date | number = new Date()): Date {
|
|
11
|
-
return add(base, -period.amount, period.granularity);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function toMs(period: Period, now = new Date()) {
|
|
15
|
-
const prev = backward(period, now);
|
|
16
|
-
return now.getTime() - prev.getTime();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function format(p: Period) {
|
|
20
|
-
return `${p.amount} ${p.granularity}${p.amount > 1 ? 's' : ''}`;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
package/src/dates/shift.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { getDate, getTime } from './parse';
|
|
2
|
-
import { DateX } from './datex';
|
|
3
|
-
import { ConstantGranularity, Granularity } from './types';
|
|
4
|
-
|
|
5
|
-
export function addDays(start: Date, amount: number, condition: (d: Date) => boolean, maxShift = 365) {
|
|
6
|
-
const dir = Math.sign(amount);
|
|
7
|
-
let left = Math.abs(amount);
|
|
8
|
-
let current = start;
|
|
9
|
-
let shift = 0;
|
|
10
|
-
while (left > 0 && shift < maxShift) {
|
|
11
|
-
++shift;
|
|
12
|
-
|
|
13
|
-
current = add(current, dir, 'day', false);
|
|
14
|
-
if (condition(current)) {
|
|
15
|
-
--left;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return current;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export function add(date: Date | number, amount: number, granularity: Granularity, local = false): Date {
|
|
23
|
-
const res = getDate(date);
|
|
24
|
-
switch (granularity) {
|
|
25
|
-
case 'month': {
|
|
26
|
-
DateX.set(res, 'month', local, DateX.get(res, 'month', local) + amount);
|
|
27
|
-
return res;
|
|
28
|
-
}
|
|
29
|
-
case 'year': {
|
|
30
|
-
DateX.set(res, 'year', local, DateX.get(res, 'year', local) + amount);
|
|
31
|
-
return res;
|
|
32
|
-
}
|
|
33
|
-
default: {
|
|
34
|
-
return new Date(res.getTime() + amount * ConstantGranularity.toMs(granularity));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function startOf(d: Date | number, g: Granularity, local = false): Date {
|
|
40
|
-
const ms = getTime(d);
|
|
41
|
-
switch (g) {
|
|
42
|
-
case 'week': {
|
|
43
|
-
const startOfDay = startOf(d, 'day', local);
|
|
44
|
-
let v = DateX.get(startOfDay, 'day', local) + 1;
|
|
45
|
-
v -= local ? startOfDay.getDay() : startOfDay.getUTCDay();
|
|
46
|
-
DateX.set(startOfDay, 'day', local, v);
|
|
47
|
-
return startOfDay;
|
|
48
|
-
}
|
|
49
|
-
case 'month': {
|
|
50
|
-
const startOfDay = startOf(d, 'day', local);
|
|
51
|
-
DateX.set(startOfDay, 'day', local, 1);
|
|
52
|
-
return startOfDay;
|
|
53
|
-
}
|
|
54
|
-
case 'year': {
|
|
55
|
-
const startOfDay = startOf(d, 'day', local);
|
|
56
|
-
DateX.set(startOfDay, 'month', local, 0, 1);
|
|
57
|
-
return startOfDay;
|
|
58
|
-
}
|
|
59
|
-
case 'day': {
|
|
60
|
-
const startOfHour = getDate(d);
|
|
61
|
-
DateX.set(startOfHour, 'hour', local, 0, 0, 0, 0);
|
|
62
|
-
return startOfHour;
|
|
63
|
-
}
|
|
64
|
-
case 'millisecond': {
|
|
65
|
-
return getDate(d);
|
|
66
|
-
}
|
|
67
|
-
default: {
|
|
68
|
-
const granMs = ConstantGranularity.toMs(g);
|
|
69
|
-
const startMs = ms - ms % granMs;
|
|
70
|
-
return new Date(startMs);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function endOf(d: Date | number, g: Granularity, local = false): Date {
|
|
76
|
-
if (g === 'millisecond') {
|
|
77
|
-
return getDate(d);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const nextD = add(d, 1, g, local);
|
|
81
|
-
const nextDStart = startOf(nextD, g, local);
|
|
82
|
-
const nextDStartMs = nextDStart.getTime();
|
|
83
|
-
return new Date(nextDStartMs - 1);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function isSame(d1: Date | number, d2: Date | number, g: Granularity, local = false) {
|
|
87
|
-
const s1 = startOf(d1, g, local);
|
|
88
|
-
const s2 = startOf(d2, g, local);
|
|
89
|
-
return s1.getTime() === s2.getTime();
|
|
90
|
-
}
|
package/src/dates/types.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type ConstantGranularity = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week';
|
|
3
|
-
export type Granularity = ConstantGranularity | 'month' | 'year';
|
|
4
|
-
|
|
5
|
-
export namespace ConstantGranularity {
|
|
6
|
-
export function toMs(g: ConstantGranularity): number {
|
|
7
|
-
switch (g) {
|
|
8
|
-
case 'millisecond': {
|
|
9
|
-
return 1;
|
|
10
|
-
}
|
|
11
|
-
case 'second': {
|
|
12
|
-
return 1000;
|
|
13
|
-
}
|
|
14
|
-
case 'minute': {
|
|
15
|
-
return 60 * toMs('second');
|
|
16
|
-
}
|
|
17
|
-
case 'hour': {
|
|
18
|
-
return 60 * toMs('minute');
|
|
19
|
-
}
|
|
20
|
-
case 'day': {
|
|
21
|
-
return 24 * toMs('hour');
|
|
22
|
-
}
|
|
23
|
-
case 'week': {
|
|
24
|
-
return 7 * toMs('day');
|
|
25
|
-
}
|
|
26
|
-
default: {
|
|
27
|
-
throw new Error('Unsupported granularity');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
package/src/dates/yearDate.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { getDate } from './parse';
|
|
2
|
-
|
|
3
|
-
/** Useful for recurring dates like birthday */
|
|
4
|
-
export type YearDate = { day: number, month: number };
|
|
5
|
-
|
|
6
|
-
export namespace YearDate {
|
|
7
|
-
export function isValid(yd: YearDate): yd is YearDate {
|
|
8
|
-
return yd && typeof yd.day === 'number' && typeof yd.month === 'number';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function matches(yearDate: YearDate, date: Date | number, local = false) {
|
|
12
|
-
const d = getDate(date);
|
|
13
|
-
return local
|
|
14
|
-
? d.getMonth() === yearDate?.month && d.getDate() === yearDate?.day
|
|
15
|
-
: d.getUTCMonth() === yearDate?.month && d.getUTCDate() === yearDate?.day;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function toDate(yd: YearDate, year = new Date().getUTCFullYear()) {
|
|
19
|
-
if (!yd) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return new Date(Date.UTC(year, yd.month || 0, yd.day || 1, 12));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function fromDate(date: Date | number): YearDate {
|
|
26
|
-
const d = getDate(date);
|
|
27
|
-
return {
|
|
28
|
-
month: d.getUTCMonth(),
|
|
29
|
-
day: d.getUTCDate(),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function equals(yd1: YearDate, yd2: YearDate): boolean {
|
|
34
|
-
return yd1?.month === yd2?.month && yd1?.day === yd1?.month;
|
|
35
|
-
}
|
|
36
|
-
}
|