1.0.2 • Published 7 months ago

functions_to_work_with_arrays_js v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Array Utilities

A simple package for array manipulation using Lodash.

Installation

Install the package via npm:

npm install functions_to_work_with_arrays_js

Usage

Import and use the functions:

import { squareNumbers, groupBy } from 'functions_to_work_with_arrays_js';

// Example 1: Squaring numbers
const numbers = [1, 2, 3, 4, 5];
console.log(squareNumbers(numbers)); // [1, 4, 9, 16, 25]

// Example 2: Grouping objects by a key
const users = [
    { id: 1, name: 'Dima', age: 25 },
    { id: 2, name: 'Nikita', age: 25 },
    { id: 3, name: 'Andrey', age: 30 },
];
console.log(groupBy(users, 'age'));
// { '25': [{ id: 1, name: 'Dima', age: 25 }, { id: 2, name: 'Nikita', age: 25 }], '30': [{ id: 3, name: 'Andrey', age: 30 }] }
1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago