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

lo-fns

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lo-fns

Faster, smaller, fully compatible Lodash alternative

  • 0.3.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

lo-fns

NPM Bundle size Coverage

THE PROJECT IS IN DEVELOPMENT AND IS NOT YET A REPLACEMENT FOR LODASH

lo-fns is a faster and smaller, yet fully compatible Lodash alternative.

  • lo-fns is fast. Benchmarks coming soon
  • lo-fns is small. All extreme edge-case code of Lodash is gone
  • lo-fns is pure. Method arguments are never mutated
  • lo-fns is modern. It is written explicitely in ES6
  • lo-fns is safe. It is written in TypeScript and heavily tested

Why this package? Should I use it?

First of all I want to say that Lodash is great. It is an incredible toolset. However, I have some problems with it. Lodash is old (10+ years), and a lot of code targets old browsers and runtimes. The code is not tree-shakable, which makes Lodash a dependency so big, it spawned memes around the topic.

lo-fns is my attempt to rethink Lodash in a modern way. Lodash functions try to save the end user from shooting themselves in a leg by extra checks for argument types and values. My approach is to replace this with robust type definitions and tests to make sure the functions work as expected.

The functions will be exported as ES6 modules from the start, and importing them separately from each other is the intended way to use them. Tree-shaking is available in virtually every bundler, so it is silly not to take advantage of it.

In the end, I will try to make lo-fns not only a lighter, but also a faster version of Lodash (if this renders to be possible). Despite our machines being able to achive things that were unachievable a few years ago, there is still no point in using extra power when it is possible not to do so.

Install

Node

yarn add lo-fns
# or
npm install lo-fns

Browsers

<script src="https://cdn.jsdelivr.net/npm/lo-fns/dist/lo-fns.min.js"></script>

Usage

Import functions as you need them:

import { chunk } from "lo-fns";

const chunkedArray = chunk([1, 2, 3, 4, 5], 3); //=> [[1, 2, 3], [4, 5]]

lo-fns can also be used as a drop-in replacement for Lodash:

import * as _ from "lo-fns";
// or, if you really want to:
// const _ = require("lo-fns");

const chunkedArray = _.chunk([1, 2, 3, 4, 5], 3); //=> [[1, 2, 3], [4, 5]]

Keywords

FAQs

Package last updated on 19 Jun 2020

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