
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
lodash.orderby
Advanced tools
The lodash.orderby package is a utility library that provides a method for sorting collections (arrays or objects) based on multiple criteria. It is part of the larger Lodash library, which is known for its performance and ease of use.
Sort by Single Property
This feature allows you to sort an array of objects by a single property. In this example, the users array is sorted by the 'user' property in ascending order.
const _ = require('lodash.orderby');
const users = [
{ 'user': 'fred', 'age': 48 },
{ 'user': 'barney', 'age': 34 },
{ 'user': 'fred', 'age': 40 },
{ 'user': 'barney', 'age': 36 }
];
const sortedUsers = _.orderBy(users, ['user'], ['asc']);
console.log(sortedUsers);
Sort by Multiple Properties
This feature allows you to sort an array of objects by multiple properties. In this example, the users array is first sorted by the 'user' property in ascending order, and then by the 'age' property in descending order.
const _ = require('lodash.orderby');
const users = [
{ 'user': 'fred', 'age': 48 },
{ 'user': 'barney', 'age': 34 },
{ 'user': 'fred', 'age': 40 },
{ 'user': 'barney', 'age': 36 }
];
const sortedUsers = _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
console.log(sortedUsers);
Sort by Nested Properties
This feature allows you to sort an array of objects by nested properties. In this example, the users array is sorted by the 'details.age' property in ascending order.
const _ = require('lodash.orderby');
const users = [
{ 'user': 'fred', 'details': { 'age': 48 } },
{ 'user': 'barney', 'details': { 'age': 34 } },
{ 'user': 'fred', 'details': { 'age': 40 } },
{ 'user': 'barney', 'details': { 'age': 36 } }
];
const sortedUsers = _.orderBy(users, ['details.age'], ['asc']);
console.log(sortedUsers);
The sort-array package provides a simple and flexible way to sort arrays of objects by multiple properties. It is similar to lodash.orderby but is a smaller, more focused library specifically for sorting arrays.
The array-sort package allows you to sort arrays of objects by multiple properties. It is similar to lodash.orderby but offers a more concise syntax and is focused solely on sorting functionality.
The sort-by package provides a utility for sorting arrays of objects by multiple properties. It is similar to lodash.orderby but is a smaller, more lightweight library with a focus on simplicity and ease of use.
The lodash method _.orderBy
exported as a Node.js module.
Using npm:
$ {sudo -H} npm i -g npm
$ npm i --save lodash.orderby
In Node.js:
var orderBy = require('lodash.orderby');
See the documentation or package source for more details.
FAQs
The lodash method `_.orderBy` exported as a module.
The npm package lodash.orderby receives a total of 290,253 weekly downloads. As such, lodash.orderby popularity was classified as popular.
We found that lodash.orderby demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.