Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@sailshq/lodash
Advanced tools
A fork of Lodash 3.10.x with ongoing maintenance from the Sails core team.
@sailshq/lodash is a fork of the popular Lodash library, tailored specifically for use with the Sails.js framework. It provides utility functions for common programming tasks using a functional programming paradigm.
Array Manipulation
The chunk function splits an array into groups of a specified size. This is useful for breaking down large datasets into manageable chunks.
const _ = require('@sailshq/lodash');
const array = [1, 2, 3, 4, 5];
const chunkedArray = _.chunk(array, 2);
console.log(chunkedArray); // [[1, 2], [3, 4], [5]]
Object Manipulation
The pick function creates an object composed of the picked object properties. This is useful for selecting specific properties from an object.
const _ = require('@sailshq/lodash');
const object = { 'a': 1, 'b': '2', 'c': 3 };
const picked = _.pick(object, ['a', 'c']);
console.log(picked); // { 'a': 1, 'c': 3 }
String Manipulation
The capitalize function converts the first character of a string to upper case and the remaining to lower case. This is useful for formatting strings.
const _ = require('@sailshq/lodash');
const str = 'hello world';
const capitalized = _.capitalize(str);
console.log(capitalized); // 'Hello world'
Collection Manipulation
The filter function iterates over elements of a collection, returning an array of all elements that pass a predicate check. This is useful for filtering data sets.
const _ = require('@sailshq/lodash');
const users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false }
];
const activeUsers = _.filter(users, { 'active': true });
console.log(activeUsers); // [{ 'user': 'barney', 'age': 36, 'active': true }]
Lodash is a modern JavaScript utility library delivering modularity, performance, and extras. It is the original library from which @sailshq/lodash is forked. It offers a wide range of utility functions for arrays, objects, strings, and more.
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It is similar to Lodash but has a smaller footprint and fewer features.
Ramda is a practical functional library for JavaScript programmers. It is designed specifically for a functional programming style, making it different from Lodash and Underscore, which are more general-purpose utility libraries.
A fork of Lodash 3.10.x with ongoing maintenance from the Sails core team.
This repo will only be updated when there are immediate, material issues affecting expected usage, like this one. Our goal is to diverge as little as possible, and to encourage the use of Lodash 4 and above whenever possible. This repo is really just for us, and anyone else who really likes Lodash 3 exactly the way it is.
In other words, there will never be any new methods or options added to Lodash on this fork, and consequently there will be no minor version or major version bumps from this fork-- only patches.
Sails <=v0.12 users:
This is the version of Lodash exposed as a default global (
_
) in Sails apps prior to Sails v1.0....but Sails v1.0 changes that.
If your app is using Sails v1.0 or above, or if you are on <=0.12, but are not using the Lodash global, then you needn't worry about this package-- it is used interally in Sails, but does not touch userland code in your application unless you
require
it -- e.g. from your config/globals.js file. Click here to learn about how the Lodash global works in Sails v1.0.On the other hand, if your app is using Sails <=0.12 and you are using the Lodash global:
- Click here for usage docs
- Click here to see how to disable that global and use your own version of Lodash.
_.isFunction()
properly detect arrow functions (()=>{}
) and AsyncFunctions (async function(){}
or async ()=>{}
)To report a bug, click here.
Please observe the guidelines and conventions laid out in the Sails project contribution guide when opening issues or submitting pull requests.
Lodash is free and open source under the MIT License.
All ad hoc additions in this repo are also MIT-licensed, copyright © 2017 The Sails Company.
The Sails framework is free and open-source under the MIT License.
FAQs
A fork of Lodash 3.10.x with ongoing maintenance from the Sails core team.
The npm package @sailshq/lodash receives a total of 111,772 weekly downloads. As such, @sailshq/lodash popularity was classified as popular.
We found that @sailshq/lodash demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.