This package has been deprecated

Author message:

Moved to @outofsync/lodash-ex

@mediaxpost/lodashext

1.2.1 • Public • Published

lodashExt

NPM

Actual version published on npm Travis build status Total npm module downloads Codacy Badge Codacy Coverage Badge Dependencies badge

Simple and useful utility extensions for Lodash.

Installation

  npm install @mediaxpost/lodashExt

Usage

lodashExt replaces and extends lodash, so it only the lodashExt module needs to be included in your code:

  const _ = require('@mediaxpost/lodashext');

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

API Reference

_.isUnset(value) ⟾ boolean

Tests if the value provided is null or undefined

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

Results:

  true
  true
  false

_.hasValue(value) ⟾ boolean

Tests if the value provided is not null or undefined

  _.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.

  _.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

Copyright (c) 2018,2019 Jay Reardon -- Licensed under the MIT license.

Package Sidebar

Install

npm i @mediaxpost/lodashext

Weekly Downloads

0

Version

1.2.1

License

MIT

Unpacked Size

16.5 kB

Total Files

9

Last publish

Collaborators

  • chronosis