npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@s-libs/micro-dash

v17.1.0

Published

Lightweight implementations of simplified lodash functions

Downloads

8,380

Readme

Micro-dash offers a subset of the functionality found in lodash, with drastically reduced bundle size.

API Documentation

To quickly see which functions are available, and any difference from Lodash beyond the overarching ones listed below, see the api documentation.

Installation

Install using:

npm install @s-libs/micro-dash

Project goals

The main goals of this project are:

  • Api compatibility with lodash. Not in the sense that each function can do everything that its lodash counterpart can do; most are simplified (see the philosophical differences below). But they have the same names, signatures, and basic functionality.
  • Small payload size. Most functions are drastically smaller than their counterpart in lodash. For example, when it is the only function imported, map brings 14,219 bytes from lodash but only 419 bytes from Microdash. Any function that has "iteratee shorthand" in lodash has a similar difference. Every function's size comparison is provided in its documentation.
  • Pass all tests from the lodash test suite that are relevant given the differences below.
  • Supply build artifacts according to the Angular Package Format, for an optimal experience using all the common, modern build chains. This does not mean micro-dash is designed for Angular - it contains generic utility functions useful in any modern javascript environment. The Angular Package Format is the structure followed by the Angular team, published as a recommendation to improve any support libraries.

Goals that are not part of this project:

  • Complete feature parity with lodash. This project does not aspire to have a "micro" version of every function in lodash.
  • Additional functions that are not part of lodash. While there may be many other handy "utility" functions in the world, they do not belong in this library.

Differences from lodash

Below are the main differences between the implementations in this library compared to lodash. Other differences, when they exist, are listed in the documentation for each function.

  • Only designed to work with primitives, plain objects, and arrays. It is not designed or tested to handle inherited properties, symbol keys, arguments objects, primitive objects (e.g. Object(1)), Dates, Maps, Sets, etc.
  • Makes no special attempt to coerce arguments to the expected type, nor to check the type of arguments. Behavior is undefined in such cases.
  • There is no shorthand for "iteratees"; functions that accept one require you to provide an actual function.
  • Does not pass the iterated object to iteratee functions. This allows simplifications, e.g. functions like merge can be used as an iteratee for reduce without being guarded.
  • It has no special knowledge of "array like" objects; only actual arrays are treated as arrays.
  • Makes no special attempt to treat 0 and -0 differently.
  • String functions are designed for simple cases like variable names. They only treat [0-9A-Za-z] as part of words and are not smart about contractions or ordinals (e.g. I'll or 1st).
  • A modern environment/buildchain is assumed. E.g. this project uses ES6 functions directly. If you target older browsers/environments, you may need to include polyfills separately. However, it will only use features that can be polyfilled.

Credits

  • Lodash - on which this entire project's API is based, most of its tests, and some of its source.
  • DefinitelyTyped/lodash - on which some of the more complicated type definitions are based.
  • Angular CLI - which provides most of the project setup and buildchain for this library.