@newdash/newdash-es6
v5.23.1
Published
javascript/typescript utility library
Downloads
36
Maintainers
Readme
NewDash
NewDash is a hard fork of the lodash utility project, and re-build it with typescript
.
Quick Start
ESM
import first from "@newdash/newdash-es6/first" // only load `first` function
first("abc")
// => "a"
NodeJS
works as you want.
// const { first } = require("@newdash/newdash")
const { first } = require("@newdash/newdash/first") // Compatible with es6 module
first("abc")
// => "a"
ES6 or Typescript
// import { first } from "@newdash/newdash" // load all functions of @newdash
import first from "@newdash/newdash/first" // only load `first` function
first("abc")
// => "a"
Deno Runtime
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"'.
UMD Module (Browser Native)
just introduce script
with html.
<script src="https://cdn.jsdelivr.net/npm/@newdash/newdash-umd/newdash.min.js"></script>
API Document
Highlight
concurrency/limit
- limit concurrency of async operationsMutex
- exclusive executinghash
- hash js object to stable string (MD5 based)fallback
- fallback functions for resilienceLRUMap
andTTLMap
- Map implementations which concern about eviction
Different Release
In most cases, just use the @newdash/newdash
package is enough.
@newdash/newdash
- for modernnodejs
environment, ready for all build tools which based on the nodejscommonjs
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 oldnodejs
environment, ready for0.12 <= node version <= 8
.@newdash/newdash-es6
- for modern build system, withes6
module keywords so that build tool could strip the unused modules.@newdash/newdash-umd
- for native browser without any build system, please access it withunpkg
orjsdeliver