push neon reactor
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 NevWare21 Solutions LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
<h1 align="center">@nevware21/ts-async</h1>
|
||||
<h2 align="center">Promise support implementations and helpers for TypeScript built for minification</h2>
|
||||
|
||||

|
||||
[](https://codecov.io/gh/nevware21/ts-async)
|
||||
[](https://badge.fury.io/js/%40nevware21%2Fts-async)
|
||||
[](https://www.npmjs.com/package/%40nevware21/ts-async)
|
||||
[](https://www.npmjs.com/package/%40nevware21/ts-async)
|
||||
|
||||
## Description
|
||||
|
||||
This package provides support for asynchronous development with a Promise based task Scheduler, several different Promise implementations (synchronous, idle, asynchronous and native runtime wrappers), await helpers, and aliases all built and tested using TypeScript.
|
||||
One of the primary focuses of this package is to provide support for the creation of code that can be better minified, resulting in a smaller runtime payload which can directly assist with Page Load performance.
|
||||
|
||||
The Promise based Task Scheduler supports the serialized execution of tasks using promises to control when the next task should be executed (after the previous task completes), this leverages the supplied Promise implementations so that you can easily create an Idle Task Scheduler which executes the tasks using `requestIdleCallback` when using the `createIdlePromise` implementation.
|
||||
|
||||
> All of the provided Promise implementations support usage patterns via either `await` or with the included helper functions (`doAwait`, `doFinally`, `doAwaitresponse`), you can also mix and match them (use both helper and `await`) as required by your use cases.
|
||||
|
||||
### Test Environments
|
||||
- Node (18, 20, 22, 24)
|
||||
- Browser (Chromium - headless)
|
||||
- Web Worker (Chromium - headless)
|
||||
|
||||
### Documentation and details
|
||||
|
||||
See the documentation [generated from source code](https://nevware21.github.io/ts-async/typedoc/index.html) via typedoc for a full list and details of all of the available types, functions, interfaces with included examples.
|
||||
|
||||
See [Browser Support](#browser-support) for details on the supported browser environments.
|
||||
|
||||
|
||||
| Type / Function | Since | Details
|
||||
|-----------------------|-------|-----------------------
|
||||
| **Promise based Scheduler**
|
||||
| [`createTaskScheduler`](https://nevware21.github.io/ts-async/typedoc/functions/createTaskScheduler.html) | |Create a Task Scheduler using the optional promise implementation and scheduler name. The newPromise can be any value promise creation function, where the execution of the queued tasks will be processed based on how the promise implementation processes it's chained promises (asynchrounsly; synchronously; idle processing, etc)<br />There is no limit on the number of schedulers that you can create, when using more than one scheduler it is recommended that you provide a `name` to each scheduler to help identify / group promises during debugging.
|
||||
| [`ITaskScheduler`](https://nevware21.github.io/ts-async/typedoc/interfaces/ITaskScheduler.html) | 0.2.0 |Defines a Task Scheduler that uses IPromise implementations to serialize the execution of the tasks. Each added task will not get executed until the previous task has completed.
|
||||
| [`StartQueuedTaskFn`](https://nevware21.github.io/ts-async/typedoc/types/StartQueuedTaskFn.html) | 0.2.0 | Identifies the function to call to start and execute the task when its ready to be executed.
|
||||
| **Interfaces**
|
||||
| [`IPromise`](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) | |This package uses and exports the `IPromise<T>` interface which extends both the `PromiseLike<T>` and `Promise<T>` to provide type compatibility when passing the Promises created with this package to any function that expects a `Promise` (including returning from an `async function`). As part of it's definition it exposes an [optional] string `status` to represent the current state of the `Promise`. These values include `pending`, `resolved` `rejected` and `resolving` which is a special case when a Promise is being `resolved` via another Promise returned via the `thenable` onResolved / onRejected functions.
|
||||
| [`AwaitResponse`](https://nevware21.github.io/ts-async/typedoc/interfaces/AwaitResponse.html) | |This interface is used to represent the result whether resolved or rejected when using the [`doAwaitResponse`](https://nevware21.github.io/ts-async/typedoc/functions/doAwaitResponse.html), this function is useful when you want to avoid creating both a `resolved` and `rejected` functions, as this function only requires a single callback function to be used which will receive an object that conforms to this interface.
|
||||
| [`IWhileState`](https://nevware21.github.io/ts-async/typedoc/interfaces/IWhileState.html) | 0.5.0| The current state of the while loop while processing the callback function, this is passed to eht callback function.
|
||||
| [`IPromiseResult`](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromiseResult.html) | 0.5.0 |The result of a promise. It can either be fulfilled with a value, or rejected with a reason.
|
||||
| **Alias**
|
||||
| [`createPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createPromise.html)<br/> [`createAllPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAllPromise.html) <br/> [`createAllSettledPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAllSettledPromise.html) <br/> [`createAnyPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAnyPromise.html) <br/> [`createRacePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createRacePromise.html) <br/> [`createRejectedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createRejectedPromise.html) <br/> [`createResolvedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createResolvedPromise.html) <br /> <br/> [`setCreatePromiseImpl`](https://nevware21.github.io/ts-async/typedoc/functions/setCreatePromiseImpl.html) | <br /> <br /> 0.5.0 <br /> 0.5.0 <br /> 0.5.0 <br /> <br /> <br /> <br /> <br /> | These function use the current promise creator implementation that can be set via <code>[`setCreatePromiseImpl`](https://nevware21.github.io/ts-async/typedoc/functions/setCreatePromiseImpl.html)(creator: <T>(executor: PromiseExecutor<T>, timeout?: number) => IPromise<T>): void</code> <br/>Unless otherwise set this defaults to the `createNativePromise` implementation, to provide a simplified wrapper around any native runtime Promise support. <br/>Available implementation: <ul><li>[`createNativePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativePromise.html) <li>[`createAsyncPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncPromise.html) <li>[`createSyncPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncPromise.html) <li>[`createIdlePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdlePromise.html) </ul> By using these aliases, it's possible to switch between any of these implementations as needed without duplicating your code. This will not change any existing promises, it only affects new promises.
|
||||
| [`createNativePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativePromise.html) <br/> [`createNativeAllPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativeAllPromise.html) <br/> [`createNativeAllSettledPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativeAllSettledPromise.html) <br/> [`createNativeAnyPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativeAnyPromise.html) <br/> [`createNativeRacePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativeRacePromise.html) <br/> [`createNativeRejectedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativeRejectedPromise.html) <br/> [`createNativeResolvedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createNativeResolvedPromise.html) | <br /> <br /> 0.5.0 <br /> 0.5.0 <br /> 0.5.0 <br /> <br /> <br /> | These are effectively wrappers around the runtime `Promise` class, so this is effectivly the same as `new Promise(...)` but as a non-global class name it can be heavily minified to something like `a(...)`. These wrappers also add an accessible `status` property for identifying the current status of this promise. However, the `status` property is NOT available on any returned chained Promise (from calling `then`, `catch` or `finally`)
|
||||
| **Asynchronous Promise**
|
||||
| [`createAsyncPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncPromise.html) <br/> [`createAsyncAllPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncAllPromise.html) <br/> [`createAsyncAllSettledPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncAllSettledPromise.html) <br/> [`createAsyncAnyPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncAnyPromise.html) <br/> [`createAsyncRacePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncRacePromise.html) <br/> [`createAsyncRejectedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncRejectedPromise.html) <br/> [`createAsyncResolvedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createAsyncResolvedPromise.html) | <br /> <br /> 0.5.0 <br /> 0.5.0 <br /> 0.5.0 <br /> <br /> <br /> | Provides an implementation of the `Promise` contract that uses timeouts to process any chained promises (returned by `then(...)`, `catch(...)`, `finally(...)`), when creating the initial promise you can also provide (override) the default duration of the timeout (defaults to 0ms) to further delay the execution of the chained Promises.<br/>, but can also be provided) to process any chained promises (of any type)
|
||||
| **Synchronous Promise**
|
||||
| [`createSyncPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncPromise.html) <br/> [`createSyncAllPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncAllPromise.html) <br/> [`createSyncAllSettledPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncAllSettledPromise.html) <br/> [`createSyncAnyPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncAnyPromise.html) <br/> [`createSyncRacePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncRacePromise.html) <br/> [`createSyncRejectedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncRejectedPromise.html) <br/> [`createSyncResolvedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createSyncResolvedPromise.html) | <br /> <br /> 0.5.0 <br /> 0.5.0 <br /> 0.5.0 <br /> <br /> <br /> | Also implements the `Promise` contract but will immediately execute any chained promises at the point of the original promise getting resolved or rejected, or if already resolved, rejected then at the point of registering the `then`, `catch` or `finally`
|
||||
| **Idle Promise**
|
||||
| [`createIdlePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdlePromise.html) <br/> [`createIdleAllPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdleAllPromise.html) <br/> [`createIdleAllSettledPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdleAllSettledPromise.html) <br/> [`createIdleAnyPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdleAnyPromise.html) <br/> [`createIdleRacePromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdleRacePromise.html) <br/> [`createIdleRejectedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdleRejectedPromise.html) <br/> [`createIdleResolvedPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createIdleResolvedPromise.html) | <br /> <br /> 0.5.0 <br /> 0.5.0 <br /> 0.5.0 <br /> <br /> <br /> | Implements the `Promise` contract and will process any chained promises using the available `requestIdleCallback` (with no timeout by default - but can also be changes by `setDetaultIdlePromiseTimeout`). And when `requestIdleCallback` is not supported this will default to using a timeout via the [`scheduleIdleCallback` from `@nevware21/ts-utils`](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleIdleCallback.html)
|
||||
| **Timeout**
|
||||
| [`createTimeoutPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createTimeoutPromise.html) | | Creates a Promise instance that resolve or reject after the specified timeout.
|
||||
| **Helpers**
|
||||
| [`createTimeoutPromise`](https://nevware21.github.io/ts-async/typedoc/functions/createTimeoutPromise.html) | 0.5.0 | Creates a Promise instance that resolve or reject after the specified timeout.
|
||||
| [`doAwait`](https://nevware21.github.io/ts-async/typedoc/functions/doAwait.html) | | Helper which handles `await` "handling" via callback functions to avoid the TypeScript boilerplate code that is added for multiple branches. Internal it handles being passed an `IPromise` or a result value so you avoid needing to test whether the result you have is also a `Promise`.<br />It takes three (3) optional callback functions for `resolved`, `rejected` and `finally`.
|
||||
| [`doAwaitResponse`](https://nevware21.github.io/ts-async/typedoc/functions/doAwaitResponse.html) | | Helper which handles `await` "handling" via a single callback where `resolved` and `rejected` cases are handled by the same callback, this receives an `AwaitResponse` object that provides the `value` or `reason` and a flag indicating whether the Promise was `rejected`
|
||||
| [`doFinally`](https://nevware21.github.io/ts-async/typedoc/functions/doFinally.html) | | Helper to provide `finally` handling for any promise using a callback implementation, analogous to using `try` / `finally` around an `await` function or using the `finally` on the promise directly
|
||||
| [`arrForEachAsync`](https://nevware21.github.io/ts-async/typedoc/functions/arrForEachAsync.html) | 0.5.0 | Performs an asynchronous for loop where the calling function may return an [`IPromise`](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) which must be fulfilled before the next iteration is called.
|
||||
| [`doWhileAsync`](https://nevware21.github.io/ts-async/typedoc/functions/doWhileAsync.html) | 0.5.0 | Performs a while loop where the calling function may return an [`IPromise`](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) which must be fulfilled before the next iteration is called.
|
||||
| [`iterForOfAsync`](https://nevware21.github.io/ts-async/typedoc/functions/iterForOfAsync.html) | 0.5.0 | Iterates over the iterator where the calling function may return an [`IPromise`](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) which must be fulfilled before the next iteration is called.
|
||||
| **Polyfill**
|
||||
| [`PolyPromise`](https://nevware21.github.io/ts-async/typedoc/classes/PolyPromise.html) | 0.5.0 | A full polyfill for the Promise class
|
||||
|
||||
All promise implementations are validated using TypeScript with `async` / `await` and the internal helper functions `doAwait`, `doFinally` and `doAwaitResponse` helpers. Usage of the `doAwait` or `doAwaitResponse` is recommended as this avoids the additional boiler plate code that is added by TypeScript when handling the branches in an `async` / `await` operations, this does however, mean that your calling functions will also need to handle this `async` operations via callbacks rather than just causing the code path to "halt" at the `await` and can therefore may be a little more complex (depending on your implementation).
|
||||
> However, you are NOT restricted to only using `await` OR `doAwait` they can be used together. For example your public API can still be defined as asynchronous, but internally you could use `doAwait`
|
||||
```ts
|
||||
async function myApi()
|
||||
{
|
||||
await doAwait(thePromise, (result) => { ... }, (reason) => { ... });
|
||||
}
|
||||
```
|
||||
|
||||
### Unhandled Promise Rejection Event
|
||||
|
||||
All implementations will "emit/dispatch" the unhandled promise rejections event (`unhandledRejection` (node) or `unhandledrejection`) (if supported by the runtime) using the standard runtime mechanisms. So any existing handlers for native (`new Promise`) unhandled rejections will also receive them from the `idle`, `sync` and `async` implementations. The only exception to this is when the runtime (like IE) doesn't support this event in those cases "if" an `onunhandledrejection` function is registered it will be called and if that also doesn't exist it will logged to the console (if possible).
|
||||
|
||||
### Pollyfill
|
||||
|
||||
The package provides a simple polyfill wrapper which is built around the `asynchronous` promise implementation which is tested and validated against the standard native (`Promise()`) implementations for node, browser and web-worker to ensure compatibility.
|
||||
|
||||
## Language ECMAScript Support
|
||||
|
||||
### ES5
|
||||
|
||||
This library plans to maintain ES5 compatibility for all versions of v0.x and v1.x releases
|
||||
|
||||
### TypeScript Type Definitions
|
||||
|
||||
The published type definitions (`.d.ts`) include a `/// <reference lib="es2018" />` directive. This means TypeScript will automatically load ES2018 type definitions when consuming this package. This is a **type-level requirement only** — no ES2018 runtime features are needed because the library provides its own internal polyfills/shims for environments that lack them.
|
||||
|
||||
If your project explicitly sets `"lib"` in `tsconfig.json`, ensure it includes at least `"es2018"` (or the individual libs `"es2015.promise"` and `"es2018.asynciterable"`):
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2018", "dom"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> Projects that omit the `"lib"` field entirely (defaulting to the libs implied by `"target"`) may need to add it explicitly if targeting ES5.
|
||||
|
||||
### ES(future [6 next, etc])
|
||||
|
||||
Future versions of this library starting at version 2.x are planned to lift and remove the internal polyfills to support the new targetted baseline once it is defined.
|
||||
ie. It may or may not be ES6 depending on the runtime landscape and requests received.
|
||||
|
||||
When we release v2.x the supported browser matrix will also shift as required to match the defined language level supported at that time.
|
||||
|
||||
## Quickstart
|
||||
|
||||
Install the npm packare: `npm install @nevware21/ts-async --save`
|
||||
|
||||
> It is suggested / recommended that you use the following definition in your `package.json` so that you are compatible with any future releases as they become available
|
||||
> we do not intend to make ANY known breaking changes moving forward until v2.x
|
||||
> ```json
|
||||
> "@nevware21/ts-async": ">= 0.6.1 < 2.x"
|
||||
> ```
|
||||
|
||||
And then just import the helpers and use them.
|
||||
|
||||
### Simple Examples
|
||||
|
||||
#### Using Task Scheduler
|
||||
|
||||
```ts
|
||||
import { createTaskScheduler } from "@nevware21/ts-async";
|
||||
import { scheduleTimeout } from "@nevware21/ts-utils";
|
||||
|
||||
let scheduler = createTaskScheduler();
|
||||
|
||||
// Schedule (and start) task 1 using native promise
|
||||
// Because this is a new scheduler there are no other
|
||||
// pending tasks so this will be started synchronously
|
||||
let task1 = scheduler.queue(() => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(42);
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
// task1.status; => "pending" (and running)
|
||||
|
||||
// Schedule task 2 using helper function
|
||||
// The startTask function for task2 will not be called
|
||||
// until task1 has completed
|
||||
let task2 = scheduler.queue(() => {
|
||||
return createPromise((resolve) => {
|
||||
scheduleTimeout(() => {
|
||||
resolve(21);
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
// task2.status; => "pending" (not running)
|
||||
|
||||
await task1;
|
||||
// task1.status => "resolved"
|
||||
// task2.status => "pending" (but running)
|
||||
```
|
||||
|
||||
#### Using Promise Helpers
|
||||
|
||||
```ts
|
||||
import { createPromise } from "@nevware21/ts-async";
|
||||
import { scheduleTimeout } from "@nevware21/ts-utils";
|
||||
|
||||
const myPromise = createPromise((resolve, reject) => {
|
||||
scheduleTimeout(() => {
|
||||
resolve("foo");
|
||||
}, 300);
|
||||
});
|
||||
|
||||
myPromise
|
||||
.then(handleFulfilledA, handleRejectedA)
|
||||
.then(handleFulfilledB, handleRejectedB)
|
||||
.then(handleFulfilledC, handleRejectedC)
|
||||
.catch(handleRejectedAny);
|
||||
|
||||
// Create a new promise that resolves with an inner promise that will auto resolve after 1 second
|
||||
createPromise((resolveOuter) => {
|
||||
resolveOuter(
|
||||
createPromise((resolveInner) => {
|
||||
scheduleTimeout(resolveInner, 1000);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
doAwait(myPromise, (result) => {
|
||||
// Handle the result this would normally be
|
||||
// let result = await myPromise;
|
||||
}, (reason) => {
|
||||
// Handle cases when the `myPromise` is rejected
|
||||
// Using await you would handle this via try / catch
|
||||
});
|
||||
```
|
||||
|
||||
While the examples above are using the `createPromise` you can directly use the `createSyncPromise`, `createAsyncPromise`, `createIdlePromise` or `createNativePromise`, you can also mix and match them (ie. they don't all have to be the same implementation). The `createPromise` alias is provided to enable switching the underlying Promise implementation without changing any of your code.
|
||||
|
||||
## Release Notes
|
||||
|
||||
- [Releases](https://github.com/nevware21/ts-async/releases)
|
||||
- [Changelist Notes](./CHANGELIST.md)
|
||||
|
||||
## Browser Support
|
||||
|
||||
General support is currently set to ES5 supported runtimes and higher.
|
||||
|
||||
Internal polyfills are used to backfill ES5 functionality which is not provided by older browsers.
|
||||
|
||||
 |  |  |  | 
|
||||
--- | --- | --- | --- | --- |
|
||||
Latest ✔ | Latest ✔ | <center>9+ ✔</center> | Latest ✔ | Latest ✔ |
|
||||
|
||||
> Note: A PolyFill `PolyPromise` provides the standard promise implementations for IE and ES5+ environments.
|
||||
|
||||
## Contributing
|
||||
|
||||
Read our [contributing guide](./CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.
|
||||
+2120
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+8
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+1427
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+8
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+2120
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+8
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+2108
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+8
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+2108
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+8
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+1175
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+1122
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+2120
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+1163
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+1110
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+2056
File diff suppressed because it is too large
Load Diff
+126
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"name": "@nevware21/ts-async",
|
||||
"description": "support for asynchronous development with a Promise based task Scheduler, several different Promise implementations (synchronous, idle, asynchronous and native runtime wrappers), await helpers, and aliases all built and tested using TypeScript.",
|
||||
"version": "0.6.1",
|
||||
"homepage": "https://github.com/nevware21/ts-async",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/nevware21"
|
||||
},
|
||||
{
|
||||
"type": "buymeacoffee",
|
||||
"url": "https://www.buymeacoffee.com/nevware21"
|
||||
}
|
||||
],
|
||||
"sideEffects": false,
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "NevWare21 Solutions LLC",
|
||||
"email": "github+ts_async@nevware21.com"
|
||||
},
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"javascript",
|
||||
"es5",
|
||||
"promise",
|
||||
"es6.promise",
|
||||
"async",
|
||||
"asynchronous",
|
||||
"async promise",
|
||||
"asynchronous promise",
|
||||
"sync",
|
||||
"synchronous",
|
||||
"sync promise",
|
||||
"synchronous promise",
|
||||
"idle",
|
||||
"idle promise",
|
||||
"requestIdleCallback",
|
||||
"minification",
|
||||
"browser",
|
||||
"promise polyfill",
|
||||
"scheduler",
|
||||
"task scheduler"
|
||||
],
|
||||
"main": "dist/es5/main/ts-async.js",
|
||||
"esnext:main": "dist/es6/main/ts-async.js",
|
||||
"module": "dist/es5/mod/ts-async.js",
|
||||
"esnext": "dist/es6/mod/ts-async.js",
|
||||
"types": "dist/types/ts-async.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nevware21/ts-async.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nevware21/ts-async/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/nevware21/ts-async/blob/main/LICENSE"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run preproc && grunt ts_async --verbose && npm run preproc -- -restore && npm run package && npm run dtsgen",
|
||||
"rebuild": "npm run build && npm run test",
|
||||
"package": "rollup -c rollup.config.js --bundleConfigAsCjs",
|
||||
"test": "npm run preproc test && grunt ts_async-test && npm run test:node && npm run test:browser && npm run test:worker && npm run coverage:report&& npm run preproc -- -restore",
|
||||
"test:node": "nyc ts-mocha --type-check -p ./test/tsconfig.test.json \"./test/src/!(browser|worker)/**/*.test.ts\" --trace-uncaught",
|
||||
"test:browser": "karma start karma.browser.conf.js --single-run",
|
||||
"test:worker": "karma start karma.worker.conf.js --single-run",
|
||||
"debug:browser": "karma start karma.debug.browser.conf.js --watch",
|
||||
"debug:worker": "karma start karma.debug.worker.conf.js --watch",
|
||||
"lint": "grunt ts_async-lint",
|
||||
"coverage:report": "npm run coverage:nyc && npm run coverage:merge",
|
||||
"coverage:nyc": "nyc report --reporter=json",
|
||||
"coverage:merge": "merge-coverage",
|
||||
"codecov": "npm run coverage:report",
|
||||
"clean": "git clean -xdf && npm install",
|
||||
"cleanBuild": "npm run clean && npm run rebuild && npm run docs",
|
||||
"docs": "cd .. && npx typedoc",
|
||||
"rush-update": "rush update --recheck --purge --full",
|
||||
"dtsgen": "api-extractor run --local --verbose && node scripts/setTsReferences.js",
|
||||
"preproc": "ts-preproc -C ../preproc.json -R .."
|
||||
},
|
||||
"dependencies": {
|
||||
"@nevware21/ts-utils": ">= 0.15.0 < 2.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||
"@microsoft/api-extractor": "^7.48.1",
|
||||
"@nevware21/tripwire": ">= 0.1.8 < 2.x",
|
||||
"@nevware21/ts-preproc": "^0.1.4",
|
||||
"@rollup/plugin-commonjs": "^29.0.0",
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@rollup/plugin-strip": "^3.0.2",
|
||||
"@rollup/plugin-typescript": "^12.1.1",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@types/sinon": "^21.0.0",
|
||||
"chromium": "^3.0.3",
|
||||
"copyfiles": "^2.4.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"grunt": "^1.6.2",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"karma": "^6.3.20",
|
||||
"karma-chrome-launcher": "^3.1.1",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-spec-reporter": "^0.0.36",
|
||||
"karma-typescript": "^5.5.3",
|
||||
"mocha": "^10.0.0",
|
||||
"nyc": "^18.0.0",
|
||||
"puppeteer": "^25.0.2",
|
||||
"rollup": "^4.26.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-istanbul": "^5.0.0",
|
||||
"rollup-plugin-minify-es": "^1.1.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"sinon": "^14.0.0",
|
||||
"ts-mocha": "^11.1.0",
|
||||
"typedoc": "^0.28.2",
|
||||
"typedoc-github-theme": "^0.4.0",
|
||||
"typescript": "~5.2.2",
|
||||
"uglify-js": "^3.15.5"
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "es6",
|
||||
"moduleResolution": "node",
|
||||
"target": "es5",
|
||||
"lib": ["es2018", "dom"],
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"importHelpers": true,
|
||||
"noEmitHelpers": false,
|
||||
"alwaysStrict": true,
|
||||
"declaration": false,
|
||||
"outDir": "./build/base",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"removeComments": true
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules/"
|
||||
]
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"outDir": "./build/es6"
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"declaration": true,
|
||||
"declarationDir": "./build/types",
|
||||
"removeComments": false,
|
||||
"outDir": "./build/es5"
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 NevWare21 Solutions LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+382
@@ -0,0 +1,382 @@
|
||||
<h1 align="center">@nevware21/ts-utils</h1>
|
||||
<h2 align="center">Comprehensive TypeScript/JavaScript Utility Library</h2>
|
||||
|
||||

|
||||
[](https://codecov.io/gh/nevware21/ts-utils)
|
||||
[](https://badge.fury.io/js/%40nevware21%2Fts-utils)
|
||||
[](https://www.npmjs.com/package/%40nevware21/ts-utils)
|
||||
[](https://www.npmjs.com/package/%40nevware21/ts-utils)
|
||||
[](https://github.com/sponsors/nevware21)
|
||||
|
||||
## Overview
|
||||
|
||||
A comprehensive TypeScript/JavaScript utility library that provides:
|
||||
|
||||
- **Cross-Environment Support**: Works seamlessly in Node.js, browsers, and web workers
|
||||
- **Helper Functions**: Extensive collection of utility functions for common operations
|
||||
- **Type Checking**: Robust type checking utilities to improve code reliability
|
||||
- **Optimized for Minification**: Function naming designed for better minification
|
||||
- **Zero Dependencies**: Lightweight and self-contained
|
||||
- **ECMAScript Support**: Supports modern JavaScript features across ES5 to ES2023, ensuring broad usability in various environments
|
||||
- **Polyfills**: Uses built-in functions to support older environments, providing modern JavaScript features without sacrificing compatibility
|
||||
|
||||
If you find this library useful, please consider [sponsoring @nevware21](https://github.com/sponsors/nevware21) to support ongoing development and maintenance.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @nevware21/ts-utils --save
|
||||
```
|
||||
|
||||
**Recommended Version Specification:**
|
||||
```json
|
||||
"@nevware21/ts-utils": ">= 0.15.0 < 2.x"
|
||||
```
|
||||
|
||||
> Note: v0.x and v1.x maintain ES5 compatibility. Future v2.x releases will update the baseline to newer ECMAScript versions.
|
||||
|
||||
## Key Features
|
||||
|
||||
### Environment Utilities
|
||||
- Global object detection and access
|
||||
- Environment detection (Node.js, browser, web worker)
|
||||
- Safe access to environment-specific APIs
|
||||
|
||||
### Type Checking
|
||||
- Comprehensive type checking for all JavaScript types
|
||||
- Value validation helpers
|
||||
- Advanced type checks for promises, iterables, and more
|
||||
|
||||
### Array Helpers
|
||||
- Safe array manipulation with polyfills for older environments
|
||||
- Cross-environment array utilities
|
||||
- Performance-optimized implementations
|
||||
|
||||
### Object Utilities
|
||||
- Property manipulation
|
||||
- Deep copy/extend
|
||||
- Object transformation helpers
|
||||
- Property selection and omission helpers
|
||||
- Shallow defaults, conditional merges, and object diff helpers
|
||||
|
||||
### Security Helpers
|
||||
- Safe iteration over own enumerable keys while skipping dangerous property names
|
||||
- Built-in checks for prototype pollution keys such as `__proto__`, `constructor`, and `prototype`
|
||||
- Guards to avoid writing to native prototype objects during object copy or merge operations
|
||||
|
||||
### String Manipulation & Encoding
|
||||
- Case conversion (capitalized words, camelCase, kebab-case, snake_case)
|
||||
- String transformation utilities
|
||||
- Data encoding: Base64 (standard and URL-safe), Hexadecimal, URI
|
||||
- Data decoding with ES5-compatible polyfill support
|
||||
- HTML and JSON encoding for security
|
||||
- Cross-environment compatibility with optimized implementations
|
||||
|
||||
### Function Helpers
|
||||
- Function binding and proxying utilities
|
||||
- Argument manipulation
|
||||
- Function creation helpers
|
||||
|
||||
### Time and Performance
|
||||
- Consistent timing APIs across environments
|
||||
- Performance measurement utilities
|
||||
- Scheduling helpers with automatic polyfills
|
||||
- Microtask scheduling helpers that extend standard microtasks with cancellable handlers, with cross-runtime parity for Node.js, browsers, and web workers
|
||||
- [Customizable timeout handling](https://nevware21.github.io/ts-utils/timeout-overrides.html) via package-level and global overrides
|
||||
|
||||
For advanced timeout customization options, including global overrides, see our [Timeout Overrides Guide](https://nevware21.github.io/ts-utils/timeout-overrides.html).
|
||||
|
||||
### And More
|
||||
- Math utilities
|
||||
- Symbol polyfills
|
||||
- RegExp helpers
|
||||
- Iterator utilities
|
||||
|
||||
## Documentation & API Reference
|
||||
|
||||
Visit our [documentation site](https://nevware21.github.io/ts-utils/) for comprehensive guides and references.
|
||||
- Full API documentation is available [in the TypeDoc documentation](https://nevware21.github.io/ts-utils/typedoc/index.html).
|
||||
- For practical examples and usage patterns, check out our [Usage Guide](https://nevware21.github.io/ts-utils/usage-guide.html).
|
||||
- For detailed documentation on creating and using custom deep copy handlers, see the [Advanced Deep Copy Handlers](https://nevware21.github.io/ts-utils/advanced-deep-copy.html) guide.
|
||||
|
||||
### Documentation Quick Links
|
||||
|
||||
| Category | Documentation |
|
||||
|----------|---------------|
|
||||
| Getting Started | [Usage Guide](https://nevware21.github.io/ts-utils/usage-guide.html) |
|
||||
| Advanced Features | [Timeout Overrides](https://nevware21.github.io/ts-utils/timeout-overrides.html), [Deep Copy](https://nevware21.github.io/ts-utils/advanced-deep-copy.html), [Security Helpers](https://nevware21.github.io/ts-utils/security-helpers.html) |
|
||||
| Performance | [Bundle Size Optimization](https://nevware21.github.io/ts-utils/size-optimization.html) |
|
||||
| API Reference | [TypeDoc Documentation](https://nevware21.github.io/ts-utils/typedoc/index.html) |
|
||||
|
||||
### Available Utilities
|
||||
|
||||
Below is a categorized list of all available utilities with direct links to their documentation:
|
||||
|
||||
| Type | Functions / Helpers / Aliases / Polyfills
|
||||
|----------------------------|---------------------------------------------------
|
||||
| Runtime Environment Checks | <code>[getCancelIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/getCancelIdleCallback.html)(); [getDocument](https://nevware21.github.io/ts-utils/typedoc/functions/getDocument.html)(); [getGlobal](https://nevware21.github.io/ts-utils/typedoc/functions/getGlobal.html)(); [getHistory](https://nevware21.github.io/ts-utils/typedoc/functions/getHistory.html)(); [getIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/getIdleCallback.html)(); [getInst](https://nevware21.github.io/ts-utils/typedoc/functions/getInst.html)(); [getNavigator](https://nevware21.github.io/ts-utils/typedoc/functions/getNavigator.html)(); [getPerformance](https://nevware21.github.io/ts-utils/typedoc/functions/getPerformance.html)(); [getProcessNextTick](https://nevware21.github.io/ts-utils/typedoc/functions/getProcessNextTick.html)(); [getQueueMicrotask](https://nevware21.github.io/ts-utils/typedoc/functions/getQueueMicrotask.html)(); [getWindow](https://nevware21.github.io/ts-utils/typedoc/functions/getWindow.html)(); [hasDocument](https://nevware21.github.io/ts-utils/typedoc/functions/hasDocument.html)(); [hasHistory](https://nevware21.github.io/ts-utils/typedoc/functions/hasHistory.html)(); [hasNavigator](https://nevware21.github.io/ts-utils/typedoc/functions/hasNavigator.html)(); [hasPerformance](https://nevware21.github.io/ts-utils/typedoc/functions/hasPerformance.html)(); [hasProcessNextTick](https://nevware21.github.io/ts-utils/typedoc/functions/hasProcessNextTick.html)(); [hasQueueMicrotask](https://nevware21.github.io/ts-utils/typedoc/functions/hasQueueMicrotask.html)(); [hasWindow](https://nevware21.github.io/ts-utils/typedoc/functions/hasWindow.html)(); [isNode](https://nevware21.github.io/ts-utils/typedoc/functions/isNode.html)(); [isWebWorker](https://nevware21.github.io/ts-utils/typedoc/functions/isWebWorker.html)(); [hasIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/hasIdleCallback.html)(); [lazySafeGetInst](https://nevware21.github.io/ts-utils/typedoc/functions/lazySafeGetInst.html)(); </code>
|
||||
| Type Identity | <code>[isArray](https://nevware21.github.io/ts-utils/typedoc/functions/isArray.html)(); [isArrayLike](https://nevware21.github.io/ts-utils/typedoc/functions/isArrayLike.html)(); [isArrayBuffer](https://nevware21.github.io/ts-utils/typedoc/functions/isArrayBuffer.html)(); [isAsyncFunction](https://nevware21.github.io/ts-utils/typedoc/functions/isAsyncFunction.html)(); [isAsyncGenerator](https://nevware21.github.io/ts-utils/typedoc/functions/isAsyncGenerator.html)(); [isAsyncIterable](https://nevware21.github.io/ts-utils/typedoc/functions/isAsyncIterable.html)(); [isBigInt](https://nevware21.github.io/ts-utils/typedoc/functions/isBigInt.html)(); [isBlob](https://nevware21.github.io/ts-utils/typedoc/functions/isBlob.html)(); [isBoolean](https://nevware21.github.io/ts-utils/typedoc/functions/isBoolean.html)(); [isDate](https://nevware21.github.io/ts-utils/typedoc/functions/isDate.html)(); [isElement](https://nevware21.github.io/ts-utils/typedoc/functions/isElement.html)(); [isElementLike](https://nevware21.github.io/ts-utils/typedoc/functions/isElementLike.html)(); [isError](https://nevware21.github.io/ts-utils/typedoc/functions/isError.html)(); [isFile](https://nevware21.github.io/ts-utils/typedoc/functions/isFile.html)(); [isFiniteNumber](https://nevware21.github.io/ts-utils/typedoc/functions/isFiniteNumber.html)(); [isFormData](https://nevware21.github.io/ts-utils/typedoc/functions/isFormData.html)(); [isFunction](https://nevware21.github.io/ts-utils/typedoc/functions/isFunction.html)(); [isGenerator](https://nevware21.github.io/ts-utils/typedoc/functions/isGenerator.html)(); [isInteger](https://nevware21.github.io/ts-utils/typedoc/functions/isInteger.html)(); [isIntegerInRange](https://nevware21.github.io/ts-utils/typedoc/functions/isIntegerInRange.html)(); [isIterable](https://nevware21.github.io/ts-utils/typedoc/functions/isIterable.html)(); [isIterator](https://nevware21.github.io/ts-utils/typedoc/functions/isIterator.html)(); [isMap](https://nevware21.github.io/ts-utils/typedoc/functions/isMap.html)(); [isMapLike](https://nevware21.github.io/ts-utils/typedoc/functions/isMapLike.html)(); [isNullOrUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isNullOrUndefined.html)(); [isNumber](https://nevware21.github.io/ts-utils/typedoc/functions/isNumber.html)(); [isObject](https://nevware21.github.io/ts-utils/typedoc/functions/isObject.html)(); [isPlainObject](https://nevware21.github.io/ts-utils/typedoc/functions/isPlainObject.html)(); [isPrimitive](https://nevware21.github.io/ts-utils/typedoc/functions/isPrimitive.html)(); [isPrimitiveType](https://nevware21.github.io/ts-utils/typedoc/functions/isPrimitiveType.html)(); [isPromise](https://nevware21.github.io/ts-utils/typedoc/functions/isPromise.html)(); [isPromiseLike](https://nevware21.github.io/ts-utils/typedoc/functions/isPromiseLike.html)(); [isRegExp](https://nevware21.github.io/ts-utils/typedoc/functions/isRegExp.html)(); [isSet](https://nevware21.github.io/ts-utils/typedoc/functions/isSet.html)(); [isSetLike](https://nevware21.github.io/ts-utils/typedoc/functions/isSetLike.html)(); [isStrictNullOrUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isStrictNullOrUndefined.html)(); [isStrictUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isStrictUndefined.html)(); [isString](https://nevware21.github.io/ts-utils/typedoc/functions/isString.html)(); [isThenable](https://nevware21.github.io/ts-utils/typedoc/functions/isThenable.html)(); [isTypeof](https://nevware21.github.io/ts-utils/typedoc/functions/isTypeof.html)(); [isUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isUndefined.html)(); [isWeakMap](https://nevware21.github.io/ts-utils/typedoc/functions/isWeakMap.html)(); [isWeakSet](https://nevware21.github.io/ts-utils/typedoc/functions/isWeakSet.html)();</code>
|
||||
| Value Check | <code>[hasValue](https://nevware21.github.io/ts-utils/typedoc/functions/hasValue.html)(); [isDefined](https://nevware21.github.io/ts-utils/typedoc/functions/isDefined.html)(); [isEmpty](https://nevware21.github.io/ts-utils/typedoc/functions/isEmpty.html)(); [isNotTruthy](https://nevware21.github.io/ts-utils/typedoc/functions/isNotTruthy.html)(); [isNullOrUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isNullOrUndefined.html)(); [isStrictNullOrUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isStrictNullOrUndefined.html)(); [isStrictUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isStrictUndefined.html)(); [isTruthy](https://nevware21.github.io/ts-utils/typedoc/functions/isTruthy.html)(); [isUndefined](https://nevware21.github.io/ts-utils/typedoc/functions/isUndefined.html)();</code>
|
||||
| Value | <code>[getValueByKey](https://nevware21.github.io/ts-utils/typedoc/functions/getValueByKey.html)(); [setValueByKey](https://nevware21.github.io/ts-utils/typedoc/functions/setValueByKey.html)(); [getValueByIter](https://nevware21.github.io/ts-utils/typedoc/functions/getValueByIter.html)(); [setValueByIter](https://nevware21.github.io/ts-utils/typedoc/functions/setValueByIter.html)(); [encodeAsJson](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsJson.html)(); [encodeAsHtml](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsHtml.html)(); [asString](https://nevware21.github.io/ts-utils/typedoc/functions/asString.html)(); [getIntValue](https://nevware21.github.io/ts-utils/typedoc/functions/getIntValue.html)(); [normalizeJsName](https://nevware21.github.io/ts-utils/typedoc/functions/normalizeJsName.html)();</code>
|
||||
| |
|
||||
| Array | <code>[arrAppend](https://nevware21.github.io/ts-utils/typedoc/functions/arrAppend.html)(); [arrConcat](https://nevware21.github.io/ts-utils/typedoc/functions/arrConcat.html)(); [arrAt](https://nevware21.github.io/ts-utils/typedoc/functions/arrAt.html)(); [arrChunk](https://nevware21.github.io/ts-utils/typedoc/functions/arrChunk.html)(); [arrCompact](https://nevware21.github.io/ts-utils/typedoc/functions/arrCompact.html)(); [arrContains](https://nevware21.github.io/ts-utils/typedoc/functions/arrContains.html)(); [arrDifference](https://nevware21.github.io/ts-utils/typedoc/functions/arrDifference.html)(); [arrDrop](https://nevware21.github.io/ts-utils/typedoc/functions/arrDrop.html)(); [arrDropWhile](https://nevware21.github.io/ts-utils/typedoc/functions/arrDropWhile.html)(); [arrEvery](https://nevware21.github.io/ts-utils/typedoc/functions/arrEvery.html)(); [arrFilter](https://nevware21.github.io/ts-utils/typedoc/functions/arrFilter.html)(); [arrFill](https://nevware21.github.io/ts-utils/typedoc/functions/arrFill.html)(); [arrFind](https://nevware21.github.io/ts-utils/typedoc/functions/arrFind.html)(); [arrFindIndex](https://nevware21.github.io/ts-utils/typedoc/functions/arrFindIndex.html)(); [arrFindLast](https://nevware21.github.io/ts-utils/typedoc/functions/arrFindLast.html)(); [arrFindLastIndex](https://nevware21.github.io/ts-utils/typedoc/functions/arrFindLastIndex.html)(); [arrFlatten](https://nevware21.github.io/ts-utils/typedoc/functions/arrFlatten.html)(); [arrForEach](https://nevware21.github.io/ts-utils/typedoc/functions/arrForEach.html)(); [arrFrom](https://nevware21.github.io/ts-utils/typedoc/functions/arrFrom.html)(); [arrGroupBy](https://nevware21.github.io/ts-utils/typedoc/functions/arrGroupBy.html)(); [arrIncludes](https://nevware21.github.io/ts-utils/typedoc/functions/arrIncludes.html)(); [arrIndexKeys](https://nevware21.github.io/ts-utils/typedoc/functions/arrIndexKeys.html)(); [arrIndexOf](https://nevware21.github.io/ts-utils/typedoc/functions/arrIndexOf.html)(); [arrIntersection](https://nevware21.github.io/ts-utils/typedoc/functions/arrIntersection.html)(); [arrKeys](https://nevware21.github.io/ts-utils/typedoc/functions/arrKeys.html)(); [arrLastIndexOf](https://nevware21.github.io/ts-utils/typedoc/functions/arrLastIndexOf.html)(); [arrMap](https://nevware21.github.io/ts-utils/typedoc/functions/arrMap.html)(); [arrPartition](https://nevware21.github.io/ts-utils/typedoc/functions/arrPartition.html)(); [arrReduce](https://nevware21.github.io/ts-utils/typedoc/functions/arrReduce.html)(); [arrReverse](https://nevware21.github.io/ts-utils/typedoc/functions/arrReverse.html)(); [arrRotate](https://nevware21.github.io/ts-utils/typedoc/functions/arrRotate.html)(); [arrSample](https://nevware21.github.io/ts-utils/typedoc/functions/arrSample.html)(); [arrShuffle](https://nevware21.github.io/ts-utils/typedoc/functions/arrShuffle.html)(); [arrSlice](https://nevware21.github.io/ts-utils/typedoc/functions/arrSlice.html)(); [arrSome](https://nevware21.github.io/ts-utils/typedoc/functions/arrSome.html)(); [arrTake](https://nevware21.github.io/ts-utils/typedoc/functions/arrTake.html)(); [arrTakeWhile](https://nevware21.github.io/ts-utils/typedoc/functions/arrTakeWhile.html)(); [arrUnion](https://nevware21.github.io/ts-utils/typedoc/functions/arrUnion.html)(); [arrUnique](https://nevware21.github.io/ts-utils/typedoc/functions/arrUnique.html)(); [arrUnzip](https://nevware21.github.io/ts-utils/typedoc/functions/arrUnzip.html)(); [arrWith](https://nevware21.github.io/ts-utils/typedoc/functions/arrWith.html)(); [arrZip](https://nevware21.github.io/ts-utils/typedoc/functions/arrZip.html)(); [getLength](https://nevware21.github.io/ts-utils/typedoc/functions/getLength.html)(); [isArray](https://nevware21.github.io/ts-utils/typedoc/functions/isArray.html)();<br/>[polyIsArray](https://nevware21.github.io/ts-utils/typedoc/functions/polyIsArray.html)(); [polyArrIncludes](https://nevware21.github.io/ts-utils/typedoc/functions/polyArrIncludes.html)(); [polyArrFind](https://nevware21.github.io/ts-utils/typedoc/functions/polyArrFind.html)(); [polyArrFindIndex](https://nevware21.github.io/ts-utils/typedoc/functions/polyArrFindIndex.html)(); [polyArrFindLast](https://nevware21.github.io/ts-utils/typedoc/functions/polyArrFindLast.html)(); [polyArrFindLastIndex](https://nevware21.github.io/ts-utils/typedoc/functions/polyArrFindLastIndex.html)(); [polyArrFrom](https://nevware21.github.io/ts-utils/typedoc/functions/polyArrFrom.html)(); </code>
|
||||
| ArrayLike | <code>[arrAt](https://nevware21.github.io/ts-utils/typedoc/functions/arrAt.html)(); [arrChunk](https://nevware21.github.io/ts-utils/typedoc/functions/arrChunk.html)(); [arrCompact](https://nevware21.github.io/ts-utils/typedoc/functions/arrCompact.html)(); [arrContains](https://nevware21.github.io/ts-utils/typedoc/functions/arrContains.html)(); [arrDifference](https://nevware21.github.io/ts-utils/typedoc/functions/arrDifference.html)(); [arrDrop](https://nevware21.github.io/ts-utils/typedoc/functions/arrDrop.html)(); [arrDropWhile](https://nevware21.github.io/ts-utils/typedoc/functions/arrDropWhile.html)(); [arrEvery](https://nevware21.github.io/ts-utils/typedoc/functions/arrEvery.html)(); [arrFilter](https://nevware21.github.io/ts-utils/typedoc/functions/arrFilter.html)(); [arrFill](https://nevware21.github.io/ts-utils/typedoc/functions/arrFill.html)(); [arrFind](https://nevware21.github.io/ts-utils/typedoc/functions/arrFind.html)(); [arrFindIndex](https://nevware21.github.io/ts-utils/typedoc/functions/arrFindIndex.html)(); [arrFindLast](https://nevware21.github.io/ts-utils/typedoc/functions/arrFindLast.html)(); [arrFindLastIndex](https://nevware21.github.io/ts-utils/typedoc/functions/arrFindLastIndex.html)(); [arrFlatten](https://nevware21.github.io/ts-utils/typedoc/functions/arrFlatten.html)(); [arrForEach](https://nevware21.github.io/ts-utils/typedoc/functions/arrForEach.html)(); [arrFrom](https://nevware21.github.io/ts-utils/typedoc/functions/arrFrom.html)(); [arrGroupBy](https://nevware21.github.io/ts-utils/typedoc/functions/arrGroupBy.html)(); [arrIncludes](https://nevware21.github.io/ts-utils/typedoc/functions/arrIncludes.html)(); [arrIndexKeys](https://nevware21.github.io/ts-utils/typedoc/functions/arrIndexKeys.html)(); [arrIndexOf](https://nevware21.github.io/ts-utils/typedoc/functions/arrIndexOf.html)(); [arrIntersection](https://nevware21.github.io/ts-utils/typedoc/functions/arrIntersection.html)(); [arrKeys](https://nevware21.github.io/ts-utils/typedoc/functions/arrKeys.html)(); [arrLastIndexOf](https://nevware21.github.io/ts-utils/typedoc/functions/arrLastIndexOf.html)(); [arrMap](https://nevware21.github.io/ts-utils/typedoc/functions/arrMap.html)(); [arrPartition](https://nevware21.github.io/ts-utils/typedoc/functions/arrPartition.html)(); [arrReduce](https://nevware21.github.io/ts-utils/typedoc/functions/arrReduce.html)(); [arrReverse](https://nevware21.github.io/ts-utils/typedoc/functions/arrReverse.html)(); [arrRotate](https://nevware21.github.io/ts-utils/typedoc/functions/arrRotate.html)(); [arrSample](https://nevware21.github.io/ts-utils/typedoc/functions/arrSample.html)(); [arrShuffle](https://nevware21.github.io/ts-utils/typedoc/functions/arrShuffle.html)(); [arrSlice](https://nevware21.github.io/ts-utils/typedoc/functions/arrSlice.html)(); [arrSome](https://nevware21.github.io/ts-utils/typedoc/functions/arrSome.html)(); [arrTake](https://nevware21.github.io/ts-utils/typedoc/functions/arrTake.html)(); [arrTakeWhile](https://nevware21.github.io/ts-utils/typedoc/functions/arrTakeWhile.html)(); [arrUnion](https://nevware21.github.io/ts-utils/typedoc/functions/arrUnion.html)(); [arrUnique](https://nevware21.github.io/ts-utils/typedoc/functions/arrUnique.html)(); [arrUnzip](https://nevware21.github.io/ts-utils/typedoc/functions/arrUnzip.html)(); [arrWith](https://nevware21.github.io/ts-utils/typedoc/functions/arrWith.html)(); [arrZip](https://nevware21.github.io/ts-utils/typedoc/functions/arrZip.html)(); [getLength](https://nevware21.github.io/ts-utils/typedoc/functions/getLength.html)(); [objEntries](https://nevware21.github.io/ts-utils/typedoc/functions/objEntries.html)(); [objValues](https://nevware21.github.io/ts-utils/typedoc/functions/objValues.html)();</code>
|
||||
| DOM | <code>[isElement](https://nevware21.github.io/ts-utils/typedoc/functions/isElement.html)(); [isElementLike](https://nevware21.github.io/ts-utils/typedoc/functions/isElementLike.html)();</code>
|
||||
| Enum | <code>[createEnum](https://nevware21.github.io/ts-utils/typedoc/functions/createEnum.html)(); [createEnumKeyMap](https://nevware21.github.io/ts-utils/typedoc/functions/createEnumKeyMap.html)(); [createEnumValueMap](https://nevware21.github.io/ts-utils/typedoc/functions/createEnumValueMap.html)(); [createSimpleMap](https://nevware21.github.io/ts-utils/typedoc/functions/createSimpleMap.html)(); [createTypeMap](https://nevware21.github.io/ts-utils/typedoc/functions/createTypeMap.html)();</code>
|
||||
| Error | <code>[createCustomError](https://nevware21.github.io/ts-utils/typedoc/functions/createCustomError.html)(); [isError](https://nevware21.github.io/ts-utils/typedoc/functions/isError.html)(); [throwError](https://nevware21.github.io/ts-utils/typedoc/functions/throwError.html)(); [throwRangeError](https://nevware21.github.io/ts-utils/typedoc/functions/throwRangeError.html)(); [throwTypeError](https://nevware21.github.io/ts-utils/typedoc/functions/throwTypeError.html)(); [throwUnsupported](https://nevware21.github.io/ts-utils/typedoc/functions/throwUnsupported.html)();</code>
|
||||
| Function | <code>[fnApply](https://nevware21.github.io/ts-utils/typedoc/functions/fnApply.html)(); [fnBind](https://nevware21.github.io/ts-utils/typedoc/functions/fnBind.html)(); [fnBindArgs](https://nevware21.github.io/ts-utils/typedoc/functions/fnBindArgs.html)(); [fnCall](https://nevware21.github.io/ts-utils/typedoc/functions/fnCall.html)(); [createFnDeferredProxy](https://nevware21.github.io/ts-utils/typedoc/functions/createFnDeferredProxy.html)(); [createProxyFuncs](https://nevware21.github.io/ts-utils/typedoc/functions/createProxyFuncs.html)(); [readArgs](https://nevware21.github.io/ts-utils/typedoc/functions/readArgs.html)();</code>
|
||||
| Idle | <code>[getCancelIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/getCancelIdleCallback.html)(); [getIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/getIdleCallback.html)(); [hasIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/hasIdleCallback.html)(); [setDefaultIdleTimeout](https://nevware21.github.io/ts-utils/typedoc/functions/setDefaultIdleTimeout.html)(); [setDefaultMaxExecutionTime](https://nevware21.github.io/ts-utils/typedoc/functions/setDefaultMaxExecutionTime.html)(); </code>
|
||||
| Iterator | <code>[createArrayIterator](https://nevware21.github.io/ts-utils/typedoc/functions/createArrayIterator.html)(); [createIterator](https://nevware21.github.io/ts-utils/typedoc/functions/createIterator.html)(); [createIterable](https://nevware21.github.io/ts-utils/typedoc/functions/createIterable.html)(); [createIterableIterator](https://nevware21.github.io/ts-utils/typedoc/functions/createIterableIterator.html)(); [createRangeIterator](https://nevware21.github.io/ts-utils/typedoc/functions/createRangeIterator.html)(); [iterForOf](https://nevware21.github.io/ts-utils/typedoc/functions/iterForOf.html)(); [iterMap](https://nevware21.github.io/ts-utils/typedoc/functions/iterMap.html)(); [iterFilter](https://nevware21.github.io/ts-utils/typedoc/functions/iterFilter.html)(); [iterTake](https://nevware21.github.io/ts-utils/typedoc/functions/iterTake.html)(); [iterReduce](https://nevware21.github.io/ts-utils/typedoc/functions/iterReduce.html)(); [iterSome](https://nevware21.github.io/ts-utils/typedoc/functions/iterSome.html)(); [iterEvery](https://nevware21.github.io/ts-utils/typedoc/functions/iterEvery.html)(); [iterToArray](https://nevware21.github.io/ts-utils/typedoc/functions/iterToArray.html)(); [iterUnion](https://nevware21.github.io/ts-utils/typedoc/functions/iterUnion.html)(); [iterIntersection](https://nevware21.github.io/ts-utils/typedoc/functions/iterIntersection.html)(); [iterDifference](https://nevware21.github.io/ts-utils/typedoc/functions/iterDifference.html)(); [isAsyncIterable](https://nevware21.github.io/ts-utils/typedoc/functions/isAsyncIterable.html)(); [isIterable](https://nevware21.github.io/ts-utils/typedoc/functions/isIterable.html)(); [isIterator](https://nevware21.github.io/ts-utils/typedoc/functions/isIterator.html)(); [makeIterable](https://nevware21.github.io/ts-utils/typedoc/functions/makeIterable.html)(); [arrAppend](https://nevware21.github.io/ts-utils/typedoc/functions/arrAppend.html)(); [arrFrom](https://nevware21.github.io/ts-utils/typedoc/functions/arrFrom.html)(); [arrToMap](https://nevware21.github.io/ts-utils/typedoc/functions/arrToMap.html)();</code>
|
||||
| Number | <code>[getIntValue](https://nevware21.github.io/ts-utils/typedoc/functions/getIntValue.html)(); [isInteger](https://nevware21.github.io/ts-utils/typedoc/functions/isInteger.html)(); [isIntegerInRange](https://nevware21.github.io/ts-utils/typedoc/functions/isIntegerInRange.html)(); [isFiniteNumber](https://nevware21.github.io/ts-utils/typedoc/functions/isFiniteNumber.html)(); [isNumber](https://nevware21.github.io/ts-utils/typedoc/functions/isNumber.html)();</code>
|
||||
| Math | <code>[mathAbs](https://nevware21.github.io/ts-utils/typedoc/functions/mathAbs.html)(); [mathAcos](https://nevware21.github.io/ts-utils/typedoc/functions/mathAcos.html)(); [mathAsin](https://nevware21.github.io/ts-utils/typedoc/functions/mathAsin.html)(); [mathAtan](https://nevware21.github.io/ts-utils/typedoc/functions/mathAtan.html)(); [mathAtan2](https://nevware21.github.io/ts-utils/typedoc/functions/mathAtan2.html)(); [mathCeil](https://nevware21.github.io/ts-utils/typedoc/functions/mathCeil.html)(); [mathCos](https://nevware21.github.io/ts-utils/typedoc/functions/mathCos.html)(); [mathExp](https://nevware21.github.io/ts-utils/typedoc/functions/mathExp.html)(); [mathFloor](https://nevware21.github.io/ts-utils/typedoc/functions/mathFloor.html)(); [mathLog](https://nevware21.github.io/ts-utils/typedoc/functions/mathLog.html)(); [mathMax](https://nevware21.github.io/ts-utils/typedoc/functions/mathMax.html)(); [mathMin](https://nevware21.github.io/ts-utils/typedoc/functions/mathMin.html)(); [mathPow](https://nevware21.github.io/ts-utils/typedoc/functions/mathPow.html)(); [mathRandom](https://nevware21.github.io/ts-utils/typedoc/functions/mathRandom.html)(); [mathRound](https://nevware21.github.io/ts-utils/typedoc/functions/mathRound.html)(); [mathSin](https://nevware21.github.io/ts-utils/typedoc/functions/mathSin.html)(); [mathSqrt](https://nevware21.github.io/ts-utils/typedoc/functions/mathSqrt.html)(); [mathTan](https://nevware21.github.io/ts-utils/typedoc/functions/mathTan.html)(); [mathToInt](https://nevware21.github.io/ts-utils/typedoc/functions/mathToInt.html)(); [mathTrunc](https://nevware21.github.io/ts-utils/typedoc/functions/mathTrunc.html)();</code>
|
||||
| Object | <code>[deepExtend](https://nevware21.github.io/ts-utils/typedoc/functions/deepExtend.html)(); [forEachOwnKey](https://nevware21.github.io/ts-utils/typedoc/functions/forEachOwnKey.html)(); [forEachOwnKeySafe](https://nevware21.github.io/ts-utils/typedoc/functions/forEachOwnKeySafe.html)(); [isObject](https://nevware21.github.io/ts-utils/typedoc/functions/isObject.html)(); [isUnsafePropKey](https://nevware21.github.io/ts-utils/typedoc/functions/isUnsafePropKey.html)(); [isUnsafeTarget](https://nevware21.github.io/ts-utils/typedoc/functions/isUnsafeTarget.html)(); [objAssign](https://nevware21.github.io/ts-utils/typedoc/functions/objAssign.html)(); [objCopyProps](https://nevware21.github.io/ts-utils/typedoc/functions/objCopyProps.html)(); [objCreate](https://nevware21.github.io/ts-utils/typedoc/functions/objCreate.html)(); [objDeepCopy](https://nevware21.github.io/ts-utils/typedoc/functions/objDeepCopy.html)(); [objDeepFreeze](https://nevware21.github.io/ts-utils/typedoc/functions/objDeepFreeze.html)(); [objDefaults](https://nevware21.github.io/ts-utils/typedoc/functions/objDefaults.html)(); [objDefine](https://nevware21.github.io/ts-utils/typedoc/functions/objDefine.html)(); [objDefineAccessors](https://nevware21.github.io/ts-utils/typedoc/functions/objDefineAccessors.html)(); [objDefineGet](https://nevware21.github.io/ts-utils/typedoc/functions/objDefineGet.html)(); [objDefineProp](https://nevware21.github.io/ts-utils/typedoc/functions/objDefineProp.html)(); [objDefineProps](https://nevware21.github.io/ts-utils/typedoc/functions/objDefineProps.html)(); [objDefineProperties](https://nevware21.github.io/ts-utils/typedoc/functions/objDefineProperties.html)(); [objDiff](https://nevware21.github.io/ts-utils/typedoc/functions/objDiff.html)(); [objEntries](https://nevware21.github.io/ts-utils/typedoc/functions/objEntries.html)(); [objExtend](https://nevware21.github.io/ts-utils/typedoc/functions/objExtend.html)(); [objForEachKey](https://nevware21.github.io/ts-utils/typedoc/functions/objForEachKey.html)(); [objForEachKeySafe](https://nevware21.github.io/ts-utils/typedoc/functions/objForEachKeySafe.html)(); [objFreeze](https://nevware21.github.io/ts-utils/typedoc/functions/objFreeze.html)(); [objFromEntries](https://nevware21.github.io/ts-utils/typedoc/functions/objFromEntries.html)(); [objGetOwnPropertyDescriptor](https://nevware21.github.io/ts-utils/typedoc/functions/objGetOwnPropertyDescriptor.html)(); [objGetOwnPropertyDescriptors](https://nevware21.github.io/ts-utils/typedoc/functions/objGetOwnPropertyDescriptors.html)(); [objGetOwnPropertyNames](https://nevware21.github.io/ts-utils/typedoc/functions/objGetOwnPropertyNames.html)(); [objGetOwnPropertySymbols](https://nevware21.github.io/ts-utils/typedoc/functions/objGetOwnPropertySymbols.html)(); [objHasOwn](https://nevware21.github.io/ts-utils/typedoc/functions/objHasOwn.html)(); [objHasOwnProperty](https://nevware21.github.io/ts-utils/typedoc/functions/objHasOwnProperty.html)(); [objIs](https://nevware21.github.io/ts-utils/typedoc/functions/objIs.html)(); [objIsExtensible](https://nevware21.github.io/ts-utils/typedoc/functions/objIsExtensible.html)(); [objIsFrozen](https://nevware21.github.io/ts-utils/typedoc/functions/objIsFrozen.html)(); [objIsSealed](https://nevware21.github.io/ts-utils/typedoc/functions/objIsSealed.html)(); [objKeys](https://nevware21.github.io/ts-utils/typedoc/functions/objKeys.html)(); [objMapValues](https://nevware21.github.io/ts-utils/typedoc/functions/objMapValues.html)(); [objMergeIf](https://nevware21.github.io/ts-utils/typedoc/functions/objMergeIf.html)(); [objOmit](https://nevware21.github.io/ts-utils/typedoc/functions/objOmit.html)(); [objOmitBy](https://nevware21.github.io/ts-utils/typedoc/functions/objOmitBy.html)(); [objPick](https://nevware21.github.io/ts-utils/typedoc/functions/objPick.html)(); [objPickBy](https://nevware21.github.io/ts-utils/typedoc/functions/objPickBy.html)(); [objPreventExtensions](https://nevware21.github.io/ts-utils/typedoc/functions/objPreventExtensions.html)(); [objPropertyIsEnumerable](https://nevware21.github.io/ts-utils/typedoc/functions/objPropertyIsEnumerable.html)(); [objSeal](https://nevware21.github.io/ts-utils/typedoc/functions/objSeal.html)(); [objGetPrototypeOf](https://nevware21.github.io/ts-utils/typedoc/functions/objGetPrototypeOf.html)(); [objSetPrototypeOf](https://nevware21.github.io/ts-utils/typedoc/functions/objSetPrototypeOf.html)(); [objToString](https://nevware21.github.io/ts-utils/typedoc/functions/objToString.html)(); [objValues](https://nevware21.github.io/ts-utils/typedoc/functions/objValues.html)();<br/>[polyObjEntries](https://nevware21.github.io/ts-utils/typedoc/functions/polyObjEntries.html)(); [polyObjIs](https://nevware21.github.io/ts-utils/typedoc/functions/polyObjIs.html)(); [polyObjKeys](https://nevware21.github.io/ts-utils/typedoc/functions/polyObjKeys.html)();</code>
|
||||
| String | <code>[asString](https://nevware21.github.io/ts-utils/typedoc/functions/asString.html)(); [getLength](https://nevware21.github.io/ts-utils/typedoc/functions/getLength.html)(); [isString](https://nevware21.github.io/ts-utils/typedoc/functions/isString.html)(); [strCount](https://nevware21.github.io/ts-utils/typedoc/functions/strCount.html)(); [strEndsWith](https://nevware21.github.io/ts-utils/typedoc/functions/strEndsWith.html)(); [strIndexOf](https://nevware21.github.io/ts-utils/typedoc/functions/strIndexOf.html)(); [strIsNullOrEmpty](https://nevware21.github.io/ts-utils/typedoc/functions/strIsNullOrEmpty.html)(); [strIsNullOrWhiteSpace](https://nevware21.github.io/ts-utils/typedoc/functions/strIsNullOrWhiteSpace.html)(); [strLastIndexOf](https://nevware21.github.io/ts-utils/typedoc/functions/strLastIndexOf.html)(); [strLeft](https://nevware21.github.io/ts-utils/typedoc/functions/strLeft.html)(); [strPadEnd](https://nevware21.github.io/ts-utils/typedoc/functions/strPadEnd.html)(); [strPadStart](https://nevware21.github.io/ts-utils/typedoc/functions/strPadStart.html)(); [strRepeat](https://nevware21.github.io/ts-utils/typedoc/functions/strRepeat.html)(); [strReplace](https://nevware21.github.io/ts-utils/typedoc/functions/strReplace.html)(); [strReplaceAll](https://nevware21.github.io/ts-utils/typedoc/functions/strReplaceAll.html)(); [strRight](https://nevware21.github.io/ts-utils/typedoc/functions/strRight.html)(); [strSlice](https://nevware21.github.io/ts-utils/typedoc/functions/strSlice.html)(); [strSplit](https://nevware21.github.io/ts-utils/typedoc/functions/strSplit.html)(); [strStartsWith](https://nevware21.github.io/ts-utils/typedoc/functions/strStartsWith.html)(); [strSubstr](https://nevware21.github.io/ts-utils/typedoc/functions/strSubstr.html)(); [strSubstring](https://nevware21.github.io/ts-utils/typedoc/functions/strSubstring.html)(); [strSymSplit](https://nevware21.github.io/ts-utils/typedoc/functions/strSymSplit.html)(); [strTruncate](https://nevware21.github.io/ts-utils/typedoc/functions/strTruncate.html)(); [strTrim](https://nevware21.github.io/ts-utils/typedoc/functions/strTrim.html)(); [strTrimEnd](https://nevware21.github.io/ts-utils/typedoc/functions/strTrimEnd.html)(); [strTrimLeft](https://nevware21.github.io/ts-utils/typedoc/functions/strTrimLeft.html)(); [strTrimRight](https://nevware21.github.io/ts-utils/typedoc/functions/strTrimRight.html)(); [strTrimStart](https://nevware21.github.io/ts-utils/typedoc/functions/strTrimStart.html)(); [strLetterCase](https://nevware21.github.io/ts-utils/typedoc/functions/strLetterCase.html)(); [strCapitalizeWords](https://nevware21.github.io/ts-utils/typedoc/functions/strCapitalizeWords.html)(); [strCamelCase](https://nevware21.github.io/ts-utils/typedoc/functions/strCamelCase.html)(); [strKebabCase](https://nevware21.github.io/ts-utils/typedoc/functions/strKebabCase.html)(); [strSnakeCase](https://nevware21.github.io/ts-utils/typedoc/functions/strSnakeCase.html)(); [strUpper](https://nevware21.github.io/ts-utils/typedoc/functions/strUpper.html)(); [strLower](https://nevware21.github.io/ts-utils/typedoc/functions/strLower.html)(); [strContains](https://nevware21.github.io/ts-utils/typedoc/functions/strContains.html)(); [strIncludes](https://nevware21.github.io/ts-utils/typedoc/functions/strIncludes.html)(); <br/>[polyStrSubstr](https://nevware21.github.io/ts-utils/typedoc/functions/polyStrSubstr.html)(); [polyStrTrim](https://nevware21.github.io/ts-utils/typedoc/functions/polyStrTrim.html)(); [polyStrTrimEnd](https://nevware21.github.io/ts-utils/typedoc/functions/polyStrTrimEnd.html)(); [polyStrTrimStart](https://nevware21.github.io/ts-utils/typedoc/functions/polyStrTrimStart.html)(); [polyStrIncludes](https://nevware21.github.io/ts-utils/typedoc/functions/polyStrIncludes.html)(); </code>
|
||||
| Symbol | <code>[WellKnownSymbols](https://nevware21.github.io/ts-utils/typedoc/enums/WellKnownSymbols.html) (const enum);<br/>[getKnownSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/getKnownSymbol.html)(); [getSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/getSymbol.html)(); [hasSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/hasSymbol.html)(); [isSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/isSymbol.html)(); [newSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/newSymbol.html)(); [symbolFor](https://nevware21.github.io/ts-utils/typedoc/functions/symbolFor.html)(); [symbolKeyFor](https://nevware21.github.io/ts-utils/typedoc/functions/symbolKeyFor.html)();<br/>[polyGetKnownSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/polyGetKnownSymbol.html)(); [polyNewSymbol](https://nevware21.github.io/ts-utils/typedoc/functions/polyNewSymbol.html)(); [polySymbolFor](https://nevware21.github.io/ts-utils/typedoc/functions/polySymbolFor.html)(); [polySymbolKeyFor](https://nevware21.github.io/ts-utils/typedoc/functions/polySymbolKeyFor.html)();</code><br/>Polyfills are used to automatically backfill runtimes that do not support `Symbol`, not all of the Symbol functionality is provided.
|
||||
| Timer | <code>[createTimeout](https://nevware21.github.io/ts-utils/typedoc/functions/createTimeout.html)(); [createTimeoutWith](https://nevware21.github.io/ts-utils/typedoc/functions/createTimeoutWith.html)(); [elapsedTime](https://nevware21.github.io/ts-utils/typedoc/functions/elapsedTime.html)(); [perfNow](https://nevware21.github.io/ts-utils/typedoc/functions/perfNow.html)(); [setGlobalTimeoutOverrides](https://nevware21.github.io/ts-utils/typedoc/functions/setGlobalTimeoutOverrides.html)(); [setMicroTaskFallbackOptions](https://nevware21.github.io/ts-utils/typedoc/functions/setMicroTaskFallbackOptions.html)(); [setNextTickFallbackOptions](https://nevware21.github.io/ts-utils/typedoc/functions/setNextTickFallbackOptions.html)(); [setTimeoutOverrides](https://nevware21.github.io/ts-utils/typedoc/functions/setTimeoutOverrides.html)(); [utcNow](https://nevware21.github.io/ts-utils/typedoc/functions/utcNow.html)(); [scheduleIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleIdleCallback.html)(); [scheduleInterval](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleInterval.html)(); [scheduleMicrotask](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleMicrotask.html)(); [scheduleNextTick](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleNextTick.html)(); [scheduleTimeout](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleTimeout.html)(); [scheduleTimeoutWith](https://nevware21.github.io/ts-utils/typedoc/functions/scheduleTimeoutWith.html)(); [hasIdleCallback](https://nevware21.github.io/ts-utils/typedoc/functions/hasIdleCallback.html)();</code><br/>Microtask helpers extend standard microtasks with cancellable handlers, and provide parity across all supported runtimes by using native `queueMicrotask` when present, Promise-backed scheduling when available, and a timer-backed queue otherwise. <br/>For runtimes that don't support `requestIdleCallback` normal setTimeout() is used with the values from [`setDefaultIdleTimeout`](https://nevware21.github.io/ts-utils/typedoc/functions/setDefaultIdleTimeout.html)() and [`setDefaultMaxExecutionTime`](https://nevware21.github.io/ts-utils/typedoc/functions/setDefaultMaxExecutionTime.html)(); <br /><code>[polyUtcNow](https://nevware21.github.io/ts-utils/typedoc/functions/polyUtcNow.html)();</code>
|
||||
| Conversion & Encoding | <code>[encodeAsJson](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsJson.html)(); [encodeAsHtml](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsHtml.html)(); [encodeAsBase64](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsBase64.html)(); [decodeBase64](https://nevware21.github.io/ts-utils/typedoc/functions/decodeBase64.html)(); [encodeAsBase64Url](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsBase64Url.html)(); [decodeBase64Url](https://nevware21.github.io/ts-utils/typedoc/functions/decodeBase64Url.html)(); [encodeAsHex](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsHex.html)(); [decodeHex](https://nevware21.github.io/ts-utils/typedoc/functions/decodeHex.html)(); [encodeAsUri](https://nevware21.github.io/ts-utils/typedoc/functions/encodeAsUri.html)(); [decodeUri](https://nevware21.github.io/ts-utils/typedoc/functions/decodeUri.html)(); [asString](https://nevware21.github.io/ts-utils/typedoc/functions/asString.html)(); [getIntValue](https://nevware21.github.io/ts-utils/typedoc/functions/getIntValue.html)(); [normalizeJsName](https://nevware21.github.io/ts-utils/typedoc/functions/normalizeJsName.html)(); [strLetterCase](https://nevware21.github.io/ts-utils/typedoc/functions/strLetterCase.html)(); [strCapitalizeWords](https://nevware21.github.io/ts-utils/typedoc/functions/strCapitalizeWords.html)(); [strCamelCase](https://nevware21.github.io/ts-utils/typedoc/functions/strCamelCase.html)(); [strKebabCase](https://nevware21.github.io/ts-utils/typedoc/functions/strKebabCase.html)(); [strSnakeCase](https://nevware21.github.io/ts-utils/typedoc/functions/strSnakeCase.html)(); [strUpper](https://nevware21.github.io/ts-utils/typedoc/functions/strUpper.html)(); [strLower](https://nevware21.github.io/ts-utils/typedoc/functions/strLower.html)(); </code>
|
||||
| Cache | <code>[createCachedValue](https://nevware21.github.io/ts-utils/typedoc/functions/createCachedValue.html)(); [createDeferredCachedValue](https://nevware21.github.io/ts-utils/typedoc/functions/createDeferredCachedValue.html)(); [getDeferred](https://nevware21.github.io/ts-utils/typedoc/functions/getDeferred.html)(); [getWritableDeferred](https://nevware21.github.io/ts-utils/typedoc/functions/getWritableDeferred.html)();</code>
|
||||
| Lazy | <code>[getLazy](https://nevware21.github.io/ts-utils/typedoc/functions/getLazy.html)(); [getWritableLazy](https://nevware21.github.io/ts-utils/typedoc/functions/getWritableLazy.html)(); [lazySafeGetInst](https://nevware21.github.io/ts-utils/typedoc/functions/lazySafeGetInst.html)(); [safeGetLazy](https://nevware21.github.io/ts-utils/typedoc/functions/safeGetLazy.html)(); [safeGetLazy](https://nevware21.github.io/ts-utils/typedoc/functions/safeGetLazy.html)(); [setBypassLazyCache](https://nevware21.github.io/ts-utils/typedoc/functions/setBypassLazyCache.html)();</code>
|
||||
| Safe | <code>[safe](https://nevware21.github.io/ts-utils/typedoc/functions/safe.html)(); [safeGetLazy](https://nevware21.github.io/ts-utils/typedoc/functions/safeGetLazy.html)(); [safeGet](https://nevware21.github.io/ts-utils/typedoc/functions/safeGet.html)(); [safeGetDeferred](https://nevware21.github.io/ts-utils/typedoc/functions/safeGetDeferred.html)(); [safeGetWritableDeferred](https://nevware21.github.io/ts-utils/typedoc/functions/safeGetWritableDeferred.html)(); [lazySafeGetInst](https://nevware21.github.io/ts-utils/typedoc/functions/lazySafeGetInst.html)(); [safeGetWritableLazy](https://nevware21.github.io/ts-utils/typedoc/functions/safeGetWritableLazy.html)(); </code>
|
||||
| Diagnostic | <code>[dumpObj](https://nevware21.github.io/ts-utils/typedoc/functions/dumpObj.html)(); </code>
|
||||
| RegEx | <code>[createFilenameRegex](https://nevware21.github.io/ts-utils/typedoc/functions/createFilenameRegex.html)(); [createWildcardRegex](https://nevware21.github.io/ts-utils/typedoc/functions/createWildcardRegex.html)(); [makeGlobRegex](https://nevware21.github.io/ts-utils/typedoc/functions/makeGlobRegex.html)(); </code>
|
||||
|
||||
> Unless otherwise stated in the functions documentation polyfills are used to automatically backfill unsupported functions in older ES5 runtimes
|
||||
|
||||
## Why Use ts-utils?
|
||||
|
||||
### 1. Better Minification
|
||||
|
||||
Using ts-utils helper functions can significantly reduce your bundle size compared to standard JavaScript methods:
|
||||
|
||||
```typescript
|
||||
// Standard JavaScript - Can't be minified effectively
|
||||
function stdCode(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
for (let i = 0; i < obj.length; i++) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, i)) {
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Using ts-utils - Allows better minification
|
||||
import { isArray, arrForEach, objHasOwnProperty } from "@nevware21/ts-utils";
|
||||
|
||||
function optimizedCode(obj) {
|
||||
if (isArray(obj)) {
|
||||
arrForEach(obj, (value, idx) => {
|
||||
if (objHasOwnProperty(obj, idx)) {
|
||||
// Do something
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When minified, the ts-utils version is significantly smaller as function names can be reduced to single characters.
|
||||
|
||||
### 2. Cross-Environment Compatibility
|
||||
|
||||
Write code once that works across all environments without worrying about platform-specific APIs:
|
||||
|
||||
```typescript
|
||||
import { getGlobal, isNode, isWebWorker } from "@nevware21/ts-utils";
|
||||
|
||||
// Safely access the global object in any environment
|
||||
const globalObj = getGlobal();
|
||||
|
||||
// Environment detection
|
||||
if (isNode()) {
|
||||
// Node.js specific code
|
||||
} else if (isWebWorker()) {
|
||||
// Web Worker specific code
|
||||
} else {
|
||||
// Browser specific code
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Type Safety
|
||||
|
||||
Robust type checking utilities to make your code more reliable:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
isString, isNumber, isObject, isArray,
|
||||
isNullOrUndefined, isPromise
|
||||
} from "@nevware21/ts-utils";
|
||||
|
||||
function processValue(value: any) {
|
||||
if (isString(value)) {
|
||||
return value.toUpperCase();
|
||||
} else if (isNumber(value)) {
|
||||
return value * 2;
|
||||
} else if (isArray(value)) {
|
||||
return value.length;
|
||||
} else if (isPromise(value)) {
|
||||
return value.then(result => result);
|
||||
} else if (isNullOrUndefined(value)) {
|
||||
return "No value provided";
|
||||
}
|
||||
|
||||
return "Unknown type";
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Modern ECMAScript Features
|
||||
|
||||
Support for newer ECMAScript features with backward compatibility:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
arrFindLast, arrFindLastIndex, // ES2023
|
||||
objGetOwnPropertyDescriptors, // ES2017
|
||||
strPadStart, strPadEnd, // ES2017
|
||||
strReplaceAll, // ES2021
|
||||
isBigInt, // ES2020
|
||||
isWeakMap, isWeakSet // ES2015+
|
||||
} from "@nevware21/ts-utils";
|
||||
|
||||
// Using ES2023 array methods with backward compatibility
|
||||
const numbers = [5, 12, 8, 130, 44];
|
||||
const lastBigNumber = arrFindLast(numbers, num => num > 10); // 44
|
||||
const lastBigNumberIndex = arrFindLastIndex(numbers, num => num > 10); // 4
|
||||
|
||||
// Safe property descriptor access (ES2017)
|
||||
const descriptors = objGetOwnPropertyDescriptors(myObject);
|
||||
|
||||
// String padding (ES2017)
|
||||
const paddedString = strPadStart("123", 5, "0"); // "00123"
|
||||
const paddedEnd = strPadEnd("hello", 10, "."); // "hello....."
|
||||
|
||||
// String replaceAll (ES2021)
|
||||
const replaced = strReplaceAll("a-b-a", "a", "x"); // "x-b-x"
|
||||
|
||||
// Safe type checks for modern types
|
||||
if (isBigInt(someValue)) {
|
||||
// Handle BigInt (ES2020) safely
|
||||
}
|
||||
```
|
||||
|
||||
## Test Environments
|
||||
|
||||
This library is thoroughly tested in:
|
||||
|
||||
- Node.js (18, 20, 22, 24)
|
||||
- Modern browsers (via Chromium headless)
|
||||
- Web Workers (via Chromium headless)
|
||||
|
||||
All polyfill functions are tested against native implementations to ensure full compatibility.
|
||||
|
||||
## Module Support
|
||||
|
||||
The library supports multiple module formats to accommodate different project setups:
|
||||
|
||||
- ES Modules (ESM)
|
||||
- CommonJS (CJS)
|
||||
- Universal Module Definition (UMD)
|
||||
|
||||
## Language Support
|
||||
|
||||
### ES5 Compatibility
|
||||
|
||||
This library maintains ES5 compatibility for all v0.x and v1.x releases, ensuring support for any runtime that supports ES5 or higher.
|
||||
|
||||
Internal polyfills are used to backfill ES5 functionality which is not provided by older runtimes / browsers.
|
||||
|
||||
#### Future ECMAScript Support
|
||||
|
||||
Starting with v2.x, the library plans to update its baseline to target newer ECMAScript versions, reducing the need for polyfills as browser and runtime support evolves.
|
||||
|
||||
### Browser Support
|
||||
|
||||
 |  |  |  |  | 
|
||||
--- | --- | --- | --- | --- | --- |
|
||||
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | <center>9+ ✔</center> |
|
||||
|
||||
> Internet Explorer support will be dropped in v2.x
|
||||
|
||||
### Polyfills
|
||||
|
||||
All of the included polyfills are tested against the current native implementation running in `node`, `browser` and `worker` environments to ensure that they conform to the current specification, these polyfills are only internally used for ES5 compatibility and when running in an environment (mostly IE) that does not support the required function.
|
||||
|
||||
Some additional polyfills are provided for simple backward compatibility to enable the utility functions in older environments, however, you don't have to use or include these provided polyfils. If you need to use them you will need to import the pre-packaged "polyfill" bundle (`bundle/ts-polyfills-utils.min.js`) directly by hosting it on your own CDN or all of the non-internal polyfill implementations are exported so you could implement your own version of the [polyfill initializer](https://github.com/nevware21/ts-utils/blob/main/lib/src/polyfills.ts) or more simply provide your own alternatives.
|
||||
|
||||
> Notes:
|
||||
> - While some polyfills are provided to "somewhat" support older environments this library does not intend to become a fully fledged polyfill library. And the polyfills provided (or contributed) are just the minimum set that have been required over time. And should be less necessary are time moves forward.
|
||||
> - Several functions use the [Object.defineProperty](https://caniuse.com/?search=Object.defineProperty) and therefore support is limited to runtimes or good polyfills that can correctly implement this functionality. (eg. createIterator; createIterable)
|
||||
|
||||
### TypeScript Support
|
||||
|
||||
Built with TypeScript v5.2.2, while currently limiting exported types to those supported by TypeScript v3.4+.
|
||||
|
||||
## Size Analysis and Bundle Optimization
|
||||
|
||||
### Bundle Size Impact
|
||||
|
||||
The ts-utils library is designed with size optimization as a primary goal. Each function is independently importable and has been optimized for tree-shaking in modern bundlers like Webpack and Rollup. This allows you to include only what you need in your final bundle.
|
||||
|
||||
Here's a comparison of bundle sizes when using ts-utils versus standard JavaScript approaches:
|
||||
|
||||
| Scenario | Standard JS | With ts-utils | Size Reduction |
|
||||
|----------|-------------|---------------|----------------|
|
||||
| Basic type checking | ~1.2KB | ~0.3KB | ~75% |
|
||||
| Array operations | ~0.9KB | ~0.4KB | ~55% |
|
||||
| String utilities | ~1.5KB | ~0.6KB | ~60% |
|
||||
| Object helpers | ~2.1KB | ~0.8KB | ~62% |
|
||||
|
||||
For detailed byte-level measurements and concrete size optimization strategies, check out our [Bundle Size Optimization Guide](https://nevware21.github.io/ts-utils/size-optimization.html).
|
||||
|
||||
|
||||
> Note: Actual size savings depend on your specific usage patterns, minification settings, and bundler configuration.
|
||||
|
||||
### When to Use ts-utils for Repeated Functions
|
||||
|
||||
You should consider using ts-utils helper functions when:
|
||||
|
||||
1. **Your code uses the same operations repeatedly**: If you're frequently checking types, manipulating arrays/objects, or working with strings, using ts-utils can reduce repetition and improve minification.
|
||||
|
||||
2. **Bundle size is a concern**: For applications where download size matters (e.g., mobile web apps, SPAs), ts-utils can significantly reduce your bundle size through better minification.
|
||||
|
||||
3. **Cross-environment compatibility is needed**: When your code needs to run across Node.js, browsers, and web workers without environment-specific code paths.
|
||||
|
||||
4. **You want better tree-shaking**: The library is designed to allow bundlers to eliminate unused code effectively.
|
||||
|
||||
5. **Consistent API access is important**: ts-utils provides a unified API for accessing functionality that might be implemented differently across environments.
|
||||
|
||||
For example, instead of repeating this pattern across your codebase:
|
||||
|
||||
```javascript
|
||||
// Before: Multiple instances of this pattern across your code
|
||||
if (typeof value === 'object' && value !== null && Array.isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, i)) {
|
||||
// Do something with value[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use ts-utils to make it more concise and minification-friendly:
|
||||
|
||||
```javascript
|
||||
// After: More concise, better minification
|
||||
import { isArray, arrForEach, objHasOwnProperty } from "@nevware21/ts-utils";
|
||||
|
||||
if (isArray(value)) {
|
||||
arrForEach(value, (item, idx) => {
|
||||
if (objHasOwnProperty(value, idx)) {
|
||||
// Do something with item
|
||||
}
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
For more information on performance and minification benefits, see our [Usage Guide](https://nevware21.github.io/ts-utils/usage-guide.html#performance-and-minification-benefits).
|
||||
|
||||
For detailed documentation on all available utilities, refer to the [main documentation site](https://nevware21.github.io/ts-utils/).
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
+4338
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+3
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+1253
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+2
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+4338
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+3
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+4311
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+3
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+4311
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+3
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+4343
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+3993
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+4316
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+3966
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+10553
File diff suppressed because it is too large
Load Diff
+208
@@ -0,0 +1,208 @@
|
||||
{
|
||||
"name": "@nevware21/ts-utils",
|
||||
"description": "Comprehensive TypeScript/JavaScript utility library with cross-environment support (Node.js, browser, web worker) providing helper functions, polyfills (ES5-ES2023), type checking utilities, and optimized implementations for better minification and code readability",
|
||||
"version": "0.15.0",
|
||||
"homepage": "https://github.com/nevware21/ts-utils",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Nevware21 Solutions LLC",
|
||||
"email": "github@nevware21.com"
|
||||
},
|
||||
"keywords": [
|
||||
"ts",
|
||||
"typescript",
|
||||
"js",
|
||||
"javascript",
|
||||
"minification",
|
||||
"minify",
|
||||
"utils",
|
||||
"helper",
|
||||
"node",
|
||||
"browser",
|
||||
"worker",
|
||||
"webworker",
|
||||
"polyfill",
|
||||
"ES5",
|
||||
"ES6",
|
||||
"ES7",
|
||||
"ES2015",
|
||||
"ES2016",
|
||||
"ES2017",
|
||||
"ES2018",
|
||||
"ES2019",
|
||||
"ES2020",
|
||||
"ECMAScript 5",
|
||||
"ECMAScript 6",
|
||||
"ECMAScript 7",
|
||||
"ECMAScript 2015",
|
||||
"ECMAScript 2016",
|
||||
"ECMAScript 2017",
|
||||
"ECMAScript 2018",
|
||||
"ECMAScript 2019",
|
||||
"ECMAScript 2020",
|
||||
"ECMAScript 2021",
|
||||
"ECMAScript 2022",
|
||||
"ECMAScript 2023",
|
||||
"getDocument",
|
||||
"getGlobal",
|
||||
"getHistory",
|
||||
"getInst",
|
||||
"getNavigator",
|
||||
"getWindow",
|
||||
"hasDocument",
|
||||
"hasHistory",
|
||||
"hasNavigator",
|
||||
"hasWindow",
|
||||
"isNode",
|
||||
"isWebWorker",
|
||||
"isArray",
|
||||
"isArrayBuffer",
|
||||
"isBlob",
|
||||
"isBoolean",
|
||||
"isDate",
|
||||
"isError",
|
||||
"isFile",
|
||||
"isFormData",
|
||||
"isFunction",
|
||||
"isIterable",
|
||||
"isIterator",
|
||||
"isNullOrUndefined",
|
||||
"isNumber",
|
||||
"isObject",
|
||||
"isPromise",
|
||||
"isPromiseLike",
|
||||
"isThenable",
|
||||
"isRegExp",
|
||||
"isStrictNullOrUndefined",
|
||||
"isStrictUndefined",
|
||||
"isString",
|
||||
"isTypeof",
|
||||
"isUndefined",
|
||||
"hasValue",
|
||||
"isDefined",
|
||||
"isNotTruthy",
|
||||
"isTruthy",
|
||||
"string left",
|
||||
"strLeft",
|
||||
"string right",
|
||||
"strRight",
|
||||
"normalize js name",
|
||||
"letter case",
|
||||
"lettercase",
|
||||
"camel case",
|
||||
"camelcase",
|
||||
"kebab case",
|
||||
"kebabcase",
|
||||
"snake case",
|
||||
"snakecase",
|
||||
"uppercase",
|
||||
"lowercase",
|
||||
"custom error",
|
||||
"asString",
|
||||
"hasOwn",
|
||||
"defineProperty",
|
||||
"timeout",
|
||||
"idle timer",
|
||||
"timer",
|
||||
"interval",
|
||||
"microtask",
|
||||
"queueMicrotask",
|
||||
"nextTick",
|
||||
"process-nexttick",
|
||||
"cancellable microtask",
|
||||
"function-bind",
|
||||
"includes",
|
||||
"string contains",
|
||||
"html encode",
|
||||
"deep-copy",
|
||||
"deep-clone",
|
||||
"throttle",
|
||||
"debounce",
|
||||
"memoize",
|
||||
"utility-functions",
|
||||
"cross-platform",
|
||||
"environment-detection",
|
||||
"tree-shaking",
|
||||
"bundle-size-optimization",
|
||||
"esm",
|
||||
"commonjs",
|
||||
"umd",
|
||||
"type-guards",
|
||||
"object-manipulation",
|
||||
"array-utilities",
|
||||
"string-manipulation",
|
||||
"promise-utilities",
|
||||
"async-utilities",
|
||||
"zero-dependency",
|
||||
"universal",
|
||||
"isomorphic",
|
||||
"cross-runtime",
|
||||
"environment-agnostic",
|
||||
"lodash-alternative",
|
||||
"underscore-alternative",
|
||||
"ramda-alternative",
|
||||
"starts-with",
|
||||
"ends-with",
|
||||
"string-padding",
|
||||
"string-trim",
|
||||
"string-repeat",
|
||||
"array-map",
|
||||
"array-reduce",
|
||||
"array-filter",
|
||||
"array-find",
|
||||
"array-concat",
|
||||
"object-copy",
|
||||
"object-keys",
|
||||
"lightweight",
|
||||
"performance-optimized",
|
||||
"type-safe",
|
||||
"prototype-pollution",
|
||||
"prototype-pollution-prevention",
|
||||
"secure-merge",
|
||||
"secure-copy",
|
||||
"object-security",
|
||||
"defensive-programming",
|
||||
"forEachOwnKeySafe",
|
||||
"isUnsafePropKey",
|
||||
"isUnsafeTarget",
|
||||
"arrKeys",
|
||||
"arrIndexKeys",
|
||||
"sparse-array",
|
||||
"array-like",
|
||||
"from-entries",
|
||||
"has-own",
|
||||
"base64"
|
||||
],
|
||||
"types": "./dist/types/ts-utils.d.ts",
|
||||
"main": "./dist/es5/main/ts-utils.js",
|
||||
"module": "./dist/es5/mod/ts-utils.js",
|
||||
"esnext:main": "./dist/es6/main/ts-utils.js",
|
||||
"esnext": "./dist/es6/mod/ts-utils.js",
|
||||
"esnext:module": "./dist/es6/mod/ts-utils.js",
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nevware21/ts-utils.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nevware21/ts-utils/issues"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/nevware21"
|
||||
},
|
||||
{
|
||||
"type": "other",
|
||||
"url": "https://buymeacoffee.com/nevware21"
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/nevware21/ts-utils/blob/main/LICENSE"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "es6",
|
||||
"moduleResolution": "node",
|
||||
"target": "es5",
|
||||
"lib": ["ES2015", "DOM"],
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"importHelpers": true,
|
||||
"noEmitHelpers": false,
|
||||
"alwaysStrict": true,
|
||||
"declaration": false,
|
||||
"outDir": "./build/base",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"removeComments": false
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules/"
|
||||
]
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"outDir": "./build/es6/mod"
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"declarationDir": "./build/types",
|
||||
"removeComments": false,
|
||||
"outDir": "./build/es5/mod"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user