Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ebay/nodash

Package Overview
Dependencies
Maintainers
11
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebay/nodash

Replacement for lodash, with fraction of the size.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
11
Weekly downloads
 
Created
Source

nodash

Replacement for subset of lodash, with fraction of the size.

Installation

npm i @ebay/nodash

Usage

Simply replace lodash with @ebay/nodash

const get = require('lodash/get');

// becomes

const get = require('@ebay/nodash/get');

Why?

Often, consumers of lodash use just a handful of the methods. Lodash makes this convenient by only requiring what you need:

const get = require('lodash/get'); // or require('lodash.get') if installed

However, Lodash is optimized as an entire library, which is to say it makes heavy reuse of its own methods. So using get may require baseGet, which requires castPath and toKey, which then requires isKey, stringToPath, and isSymbol... and so forth. It keeps going for many more levels.

This ends up with a bundle size of over 7kb just for using get. While that becomes cheaper the more you use Lodash, if all you use is get, it remains quite expensive. The Nodash version of the same method weighs in at ~500b for comparison.

As such, this library is targeted for just those users that need a small subset of Lodash, and not the whole library. It is not intended to be a replacement for Lodash.

Methods

Most methods are identical to Lodash. Some methods have partial support, to shed off edge cases for the sake of saving size. The API for all are otherwise identical to Lodash and can be a drop-in replacement in most cases.

NameSame as Lodash?Notes
getyesget(obj, 'path.to[0].value', defaultValue)
setyesset(obj, 'path.to[0].value', value)
hasyeshas(obj, 'path.to[0].value')
cloneDeepyescloneDeep(obj)
castArrayyescastArray(value)
isEmptynodoes not support TypedArray or Buffers. isEmpty(value)
isEqualnoonly does shallow comparison
partialyespartial(func, param1, param2)
partialRightyespartialRight(func, param1, param2)
throttlenodoes not support trailing call throttle(func, 200)

License

Copyright 2018-2019 eBay Inc.
Author/Developer: Scott Davis

Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.

Third Party Code Attribution and Licenses

This software contains code licensed by third parties. In particular, see : https://github.com/lodash/lodash/blob/master/LICENSE

Copyright JS Foundation and other contributors https://js.foundation/

Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/

This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history available at https://github.com/lodash/lodash

Keywords

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc