# lodash-mixins-collection

> A little collection of additional mix-ins for great lodash library.

Latest version **1.1.0** (published 2017-02-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install lodash-mixins-collection
pnpm add lodash-mixins-collection
yarn add lodash-mixins-collection
bun add lodash-mixins-collection
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-02-14 |
| First published | 2017-02-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adrian Smijulj |
| Maintainers | adrian1210 |
| Keywords | lodash, mixin, helper |

## Links

- npm: https://www.npmjs.com/package/lodash-mixins-collection
- Homepage: https://github.com/adrian1358/lodash-mixins#readme
- Issues: https://github.com/adrian1358/lodash-mixins/issues
- npm.io page: https://npm.io/package/lodash-mixins-collection

## 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

- 1.1.0 (latest) — 2017-02-14
- 1.0.0 — 2017-02-14

## README

# lodash-mixins
A little collection of additional mix-ins for great ```lodash``` library (https://github.com/lodash/lodash). Here you can find quick docs of each mixin - they are organized the same way as in the original ```lodash``` docs - alphabetically and by mixin category (```string```, ```collection```, ```array``` ... ).

## Installation
Install via bower using ```bower install lodash-mixins --save``` or simply download and include ```lodash-mixins.min.js```. Be sure to initialize original lodash before registering these mix-ins. The only dependency to this package is ```lodash``` itself. ES6 is not required.

NPM support added, you can download it via: ```npm i lodash-mixins-collection```
## Array

### _.in(value, array)
Alias for existing `_.includes` method. Added just to make code more readable in certain cases (notice that order of parameters is switched).

```javascript
_.in(5, [2,3,5,6]);
// produces true
```

### _.contains(array, value)
Alias for existing `_.includes` method.

```javascript
_.contains([2,3,5,6], 6);
// produces true
```

## Collection

### _.renameKeys(collection, fromKey, toKey)
Loops over collection of objects and renames a key.

```javascript
_.renameKeys([{a: 2, b:4}, {x: 3, b:3}], 'x', 'a')
// produces [{"a":2,"b":4},{"b":3,"a":3}]
```

## Lang

### _.isDefined(variable)
This is the opposite of ```_.isUndefined```.

```javascript
var a = {b: 1};
_.isDefined(a.c);
// produces false
```

### _.isNumeric(variable)
Checks if given variable represents a numeric value.

```javascript

_.isNumeric('12');
// produces true

_.isNumeric('12.5');
// produces true

_.isNumeric('12,5');
// produces false

_.isNumeric('dsa');
// produces false
```

## String

### _.connect(...)

Connects all arguments with given string. If one of the argument is an array, it will be considered as an array of values that need to be connected. You can pass any number of arguments, the last argument is the string that will connect everything.

If last argument is a string, then that will be used for connecting each part. Also, instead of a  string, an object can be passed where you can set three parameters, these are the defaults:

```json
{"main": "", "last": "", "strict": "false"}
```

If strict is set to `false` (the default setting), then values like empty strings and `null` will simply be skipped in the final output (examples below).

```javascript
_.connect('Today', 'is', 'a cool', 'day', ' ');
// produces 'Today is a cool day.'

_.connect('Today', 'is', ['a cool', 'day'], '::');
// produces 'Today::is::a::cool::day.'

_.connect('One', ['two','three','four'], null, 'five', 'six', {main: ', ', last:' and ', strict: false})
// produces 'One, two, three, four, five and six'

_.connect('One', ['two','three','four'], null, 'five', 'six', {main: ', ', last:' and ', strict: true})
// produces 'One, two, three, four, null, five and six'
```

Additional _.connect helpers are also included:

```javascript
_.spaced(...); // Connects arguments with a blank space " "
_.dashed(...); // Connects arguments with a dash "-"
_.dotted(...); // Connects arguments with a dot "."
_.slashed(...); // Connects arguments with a forward slash "/"
_.listed(...); // Connects all arguments with a comma, except last one for which 'and' word is used - useful when outputting lists in user interface
```

### _.toSlug(string)
Transforms given string to  slug.

```javascript
_.toSlug('Today is a nice day');
// produces 'today-is-a-nice-day'
```

### _.toUpperCase(string)
Just a wrapper of the original toString method.

```javascript
_.toUpperCase('very simple');
// produces 'VERY SIMPLE'
```

### _.words(sentence, count, ending)
Returns first N words from given sentence. Optionally, you can append an additional ending to the output ('...' by default).

```javascript
_.words('testing this thing right now', 3);
// produces 'testing this thing...'
```

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