Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/outofsyncstudios/lodash-ex

[DEPRECATED] Pragmatic utility extensions for Lodash
https://github.com/outofsyncstudios/lodash-ex

Last synced: about 2 months ago
JSON representation

[DEPRECATED] Pragmatic utility extensions for Lodash

Awesome Lists containing this project

README

        

# lodash-ex

[![NPM](https://nodei.co/npm/@outofsync/lodash-ex.png?downloads=true)](https://nodei.co/npm/@outofsync/lodash-ex/)

[![Actual version published on npm](http://img.shields.io/npm/v/@outofsync/lodash-ex.svg)](https://www.npmjs.org/package/@outofsync/lodash-ex)
[![Travis build status](https://travis-ci.org/OutOfSyncStudios/lodash-ex.svg)](https://www.npmjs.org/package/@outofsync/lodash-ex)
[![Total npm module downloads](http://img.shields.io/npm/dt/@outofsync/lodash-ex.svg)](https://www.npmjs.org/package/@outofsync/lodash-ex)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e60352058157440f8daf9135749f0f51)](https://www.codacy.com/app/OutOfSyncStudios/lodash-ex?utm_source=github.com&utm_medium=referral&utm_content=OutOfSyncStudios/lodash-ex&utm_campaign=Badge_Grade)
[![Codacy Coverage Badge](https://api.codacy.com/project/badge/Coverage/e60352058157440f8daf9135749f0f51)](https://www.codacy.com/app/OutOfSyncStudios/lodash-ex?utm_source=github.com&utm_medium=referral&utm_content=OutOfSyncStudios/lodash-ex&utm_campaign=Badge_Coverage)
[![Dependencies badge](https://david-dm.org/OutOfSyncStudios/lodash-ex/status.svg)](https://david-dm.org/OutOfSyncStudios/lodash-ex?view=list)

Simple and useful utility extensions for Lodash.


# [Installation](#installation)

```shell
npm install @outofsync/lodash-ex
```


# [Usage](#usage)
lodash-ex replaces and extends lodash, so it only the lodash-ex module needs to be included in your code:

```js
const _ = require('@outofsync/lodash-ex');

const data = { a: 'a', b: 'b' };
// Use lodash as you normally would
console.log(_.pick(data, ['a']);
```


# [API Reference](#api)

## _.isUnset(value) ⟾ boolean
Tests if the value provided is `null` or `undefined`

```js
_.isUnset(null);
_.isUnset(undefined);
_.isUnset(false);
```

**Results**:
```
true
true
false
```

## _.hasValue(value) ⟾ boolean
Tests if the value provided is not `null` or `undefined`

```js
_.hasValue(null);
_.hasValue(undefined);
_.hasValue(false);
```

**Results**:
```
false
false
true
```

## _.implies(a, b) ⟾ boolean
Test the logic imply operation a => b, providing the following truth table:

| A | B | Result |
| - | - | ------ |
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |

## _.bool(value) ⟾ boolean
Coerces the `value` provided to a boolean value.

```js
_.bool(false);
_.bool(0);
_.bool(0.0);
_.bool('');
_.bool(null);
_.bool(undefined);
_.bool(true);
_.bool(1);
_.bool(3.14);
_.bool('abcd');
_.bool([]);
_.bool({});
_.bool(() => {}));
```

**Results**:
```
false
false
false
false
false
false
true
true
true
true
true
true
true
```


# [License](#license)

Copyright (c) 2018,2019 Out of Sync Studios LLC -- Licensed under the MIT license.