NewDash is a hard fork of the lodash utility project, and re-build it with typescript
.
import first from "@newdash/newdash-es6/first" // only load `first` function
first("abc")
// => "a"
works as you want.
// const { first } = require("@newdash/newdash")
const { first } = require("@newdash/newdash/first") // Compatible with es6 module
first("abc")
// => "a"
// import { first } from "@newdash/newdash" // load all functions of @newdash
import first from "@newdash/newdash/first" // only load `first` function
first("abc")
// => "a"
import from CDN, remember to add .ts
suffix.
// import { add } from "https://cdn.jsdelivr.net/npm/@newdash/newdash-deno/index.ts"
import { add } from "https://cdn.jsdelivr.net/npm/@newdash/newdash-deno/add.ts"
add(1, 2)
// => 3
add('1', '2')
// => '12'
add('1', 2) // different types
// throw error: TS2345 [ERROR]: Argument of type '2' is not assignable to parameter of type '"1"'.
just introduce script
with html.
<script src="https://cdn.jsdelivr.net/npm/@newdash/newdash-umd/newdash.min.js"></script>
concurrency/limit
- limit concurrency of async operationsMutex
- exclusive executinghash
- hash js object to stable string (MD5 based)fallback
- fallback functions for resilienceLRUMap
and TTLMap
- Map implementations which concern about evictionIn most cases, just use the @newdash/newdash
package is enough.
@newdash/newdash
- for modern nodejs
environment, ready for all build tools which based on the nodejs commonjs
module system (node, react, vuejs, webpack and more).@newdash/newdash-deno
- for deno language support, with some transform, like add the '.ts' suffix for modules.@newdash/newdash-es5
- for old nodejs
environment, ready for 0.12 <= node version <= 8
.@newdash/newdash-es6
- for modern build system, with es6
module keywords so that build tool could strip the unused modules.@newdash/newdash-umd
- for native browser without any build system, please access it with unpkg
or jsdeliver