1.0.5 • Published 1 year ago

alt-lodash v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Alternate of Lodash Library

https://alt-lodash.vercel.app

CI Rate this package Join the chat at https://gitter.im/alt-lodash/developers

tree shaking nodejs

npm version license Types Included

dependents weekly downloads weekly downloads downloads jsDelivr

minified gzip

Installation

With Yarn:

yarn add alt-lodash

With npm:

npm install alt-lodash

Usage

//  import all available the methods

import _ from 'alt-lodash';     //  ESM ( ECMA Script ) module

or

const _ = require('alt-lodash');    //  cjs ( common js ) module
//  import specific methods instead of all

import { concat, chunk, forEach, filter } from 'alt-lodash';     //  ESM ( ECMA Script ) module

or

const { concat, chunk, forEach, filter } = require('alt-lodash');    //  cjs ( common js ) module

Array

Collection

Dates

Function

Lang

Math

Number

Object

String

Util

Seq

```ts
chain2(value)
```

## Arguments

```bash
value (*): The value to wrap.
```

## Returns

```bash
(Object): Returns the new wrapper instance.
```

## Example

```typescript
import { chain2, map, sortBy, head } from 'alt-lodash';

const users = [
    { 'user': 'barney', 'age': 36 },
    { 'user': 'fred', 'age': 40 },
    { 'user': 'pebbles', 'age': 1 }
];

const youngest = chain2(users)
    .fn(sortBy, 'age')
    .fn(map, (function (o: any) {
        return o.user + ' is ' + o.age;
    }))
    .fn(head)
    .value();

// => 'pebbles is 1'
```
```ts
tap2(value, interceptor)
```

## Arguments

```bash
value (*): The value to provide to interceptor.
interceptor (Function): The function to invoke.
```

## Returns

```bash
(*): Returns value.
```

## Example

```typescript
import { tap2, concat } from 'alt-lodash';

const data = [1, 2, 3];

const tappedData = tap2(data, (array: number[]) => {
    // Mutate input array.
    array.push(100);
})
    .fn(concat, [4])
    .fn(concat, [5])
    .value();

// => [1, 2, 3, 100, 4, 5]
```
  • thru ✔️
  • prototypeSymbol.iterator ( 🔜 - Work in progress - PRs most welcome )
  • prototype.at ( 🔜 - Work in progress - PRs most welcome )
  • prototype.chain ( 🔜 - Work in progress - PRs most welcome )
  • prototype.commit ( 🔜 - Work in progress - PRs most welcome )
  • prototype.next ( 🔜 - Work in progress - PRs most welcome )
  • prototype.plant ( 🔜 - Work in progress - PRs most welcome )
  • prototype.reverse ( 🔜 - Work in progress - PRs most welcome )
  • prototype.toJSON -> value ( 🔜 - Work in progress - PRs most welcome )
  • prototype.value ( 🔜 - Work in progress - PRs most welcome )
  • prototype.valueOf -> value ( 🔜 - Work in progress - PRs most welcome )