# vue-lodash

> A small wrapper for integrating lodash into VueJs

Latest version **2.1.2** (published 2020-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-lodash
pnpm add vue-lodash
yarn add vue-lodash
bun add vue-lodash
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2020-03-03 |
| First published | 2017-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 105 |
| Author | Yu-An Lin |
| Maintainers | ewocker |
| Keywords | vue, lodash, wrapper |

## Links

- npm: https://www.npmjs.com/package/vue-lodash
- Repository: https://github.com/Ewocker/vue-lodash
- Homepage: https://github.com/Ewocker/vue-lodash#readme
- Issues: https://github.com/Ewocker/vue-lodash/issues
- npm.io page: https://npm.io/package/vue-lodash

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2020-03-03
- 2.1.1 — 2020-02-16
- 2.1.0 — 2020-02-16
- 2.0.2 — 2019-03-04
- 2.0.1 — 2019-03-04
- 2.0.0 — 2018-03-23
- 1.0.4 — 2017-09-19
- 1.0.3 — 2017-04-22
- 1.0.2 — 2017-04-22
- 1.0.1 — 2017-04-22
- 1.0.0 — 2017-04-22

## README

# vue-lodash

[![NPM](https://nodei.co/npm/vue-lodash.png?downloadRank=true)](https://nodei.co/npm/vue-lodash/)
[![Known Vulnerabilities](https://snyk.io/test/github/ewocker/vue-lodash/badge.svg)](https://snyk.io/test/github/ewocker/vue-lodash)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/ewocker/vue-lodash/master/LICENSE)

> A small wrapper for integrating lodash to Vuejs
(Inspired by [vue-axios](https://github.com/imcvampire/vue-axios) plugin)

## Install

```
npm install --save vue-lodash lodash
```

## Usage

```javascript
import Vue from 'vue'
import VueLodash from 'vue-lodash'
import lodash from 'lodash'

// name is optional
Vue.use(VueLodash, { name: 'custom' , lodash: lodash })

new Vue({
  el: '#app',
  methods: {
    test() {
      console.log(this.lodash.random(20))
      console.log(this._.random(20))
      console.log(this.custom.random(20))
    },
  }
})
console.log(Vue.lodash.random(20))
console.log(Vue._.random(20))
console.log(Vue.custom.random(20))
```

## Typescript

Using __custom name__ with typescript is currently unsupported without casting.

```typescript
import Vue from 'vue'
import VueLodash from 'vue-lodash'
import lodash from 'lodash'

Vue.use(VueLodash, { name: 'custom', lodash: { map, random } })

new Vue({
  el: '#app',
  methods: {
    testLodash() {
      console.log(this.lodash.random(20))
      console.log(this._.random(20))
      console.log((this as any).custom.random(20))
    },
  }
})
console.log(Vue.lodash.random(20))
console.log(Vue._.random(20))
console.log((Vue as any).custom.random(20))
```

## Tree shaking with lodash

Only import the packages you need, note that lodash tree shaking has to do import with path to module.

```typescript
import Vue from 'vue'
import VueLodash from 'vue-lodash'
import random from 'lodash/random'
import map from 'lodash/map'

Vue.use(VueLodash, { name: 'custom', lodash: { map, random } })
```

---
_Source: https://npm.io/package/vue-lodash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
