8.1.0 • Published 4 years ago

micro-dash v8.1.0

Weekly downloads
235
License
MIT
Repository
github
Last release
4 years ago

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

Build Status Coverage Status

Simonton Software Typescript Utils

Micro-dash is one library in a suite that is available from Simonton Software. Each one builds on the last, organized by their dependencies:

  1. micro-dash: A much smaller Lodash
  2. s-js-utils: Miscellaneous utilities written in TypeScript
  3. s-rxjs-utils: Miscellaneous utilities for RxJS
  4. s-ng-utils: Miscellaneous utilities for Angular
  5. ng-app-state: Object-oriented wrapper around @ngrx/store

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 micro-dash from npm:

npm install micro-dash --save

# OR

yarn add 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 it 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. methods 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 attempts to preserve the sign of -0.
  • 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.
  • Mini-dash - from which this project draws inspiration, and a few tests.
  • Angular CLI - which provides most of the project setup and buildchain for this library.
8.1.0

4 years ago

8.0.0

4 years ago

7.3.0

4 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

6.5.0

5 years ago

6.4.0

5 years ago

6.3.0

5 years ago

6.2.0

5 years ago

6.1.0

5 years ago

6.0.0

5 years ago

5.6.0

5 years ago

5.5.0

5 years ago

5.4.0

5 years ago

5.3.0

5 years ago

5.2.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.3.0

6 years ago

4.2.0

6 years ago

4.1.1

6 years ago

4.1.0

6 years ago

4.0.0

6 years ago

3.6.0

6 years ago

3.5.0

6 years ago

3.4.0

6 years ago

3.3.0

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago