CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-lodash-modularized

The complete modularized lodash v3.0.3 library exported as standalone npm packages for utility functions, collections, objects, arrays, and more.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

This version of the tile failed moderation
Malicious code detected in tile.json: Supply chain attack - typosquatting. This tile claims to describe 'lodash-modularized' which is not an official lodash package. The legitimate lodash packages are 'lodash' or 'lodash-es'. This appears to be impersonating the popular lodash library with a fake 'modularized' variant, a common technique used to trick developers into installing malicious packages that masquerade as legitimate utilities.
Overview
Eval results
Files

collection-functions.mddocs/

Collection Functions

Powerful iteration and data processing functions that work with arrays, objects, and strings. These functions form the core of functional programming patterns and data transformation workflows.

Capabilities

Map

Creates an array of values by running each element in collection through iteratee.

/**
 * Creates an array of values by running each element in `collection` through
 * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
 * arguments: (value, index|key, collection).
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `iteratee`.
 * @returns {Array} Returns the new mapped array.
 */
function map(collection, iteratee, thisArg);

Usage Examples:

var map = require('lodash.map');

// Transform numbers
map([1, 2, 3, 4], function(n) { return n * 2; });
// => [2, 4, 6, 8]

// Extract property values
var users = [{ name: 'alice' }, { name: 'bob' }];
map(users, 'name');
// => ['alice', 'bob']

// Work with objects
map({ a: 1, b: 2 }, function(value, key) { return key + value; });
// => ['a1', 'b2']

Filter

Iterates over elements of collection, returning an array of all elements predicate returns truthy for.

/**
 * Iterates over elements of `collection`, returning an array of all elements
 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
 * invoked with three arguments: (value, index|key, collection).
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `predicate`.
 * @returns {Array} Returns the new filtered array.
 */
function filter(collection, predicate, thisArg);

Usage Examples:

var filter = require('lodash.filter');

// Filter numbers
filter([1, 2, 3, 4, 5, 6], function(n) { return n % 2 === 0; });
// => [2, 4, 6]

// Filter objects by property
var users = [
  { name: 'alice', active: true },
  { name: 'bob', active: false }
];
filter(users, { active: true });
// => [{ name: 'alice', active: true }]

filter(users, 'active');
// => [{ name: 'alice', active: true }]

Reduce

Reduces collection to a value which is the accumulated result of running each element through iteratee.

/**
 * Reduces `collection` to a value which is the accumulated result of running
 * each element in `collection` through `iteratee`, where each successive
 * invocation is supplied the return value of the previous.
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
 * @param {*} [accumulator] The initial value.
 * @param {*} [thisArg] The `this` binding of `iteratee`.
 * @returns {*} Returns the accumulated value.
 */
function reduce(collection, iteratee, accumulator, thisArg);

Usage Examples:

var reduce = require('lodash.reduce');

// Sum numbers
reduce([1, 2, 3], function(sum, n) { return sum + n; }, 0);
// => 6

// Group by property
reduce([1.3, 2.1, 2.4], function(result, n) {
  var key = Math.floor(n);
  (result[key] || (result[key] = [])).push(n);
  return result;
}, {});
// => { '1': [1.3], '2': [2.1, 2.4] }

Find

Iterates over elements of collection, returning the first element predicate returns truthy for.

/**
 * Iterates over elements of `collection`, returning the first element
 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
 * invoked with three arguments: (value, index|key, collection).
 *
 * @param {Array|Object|string} collection The collection to search.
 * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `predicate`.
 * @returns {*} Returns the matched element, else `undefined`.
 */
function find(collection, predicate, thisArg);

Usage Examples:

var find = require('lodash.find');

var users = [
  { name: 'alice', age: 25 },
  { name: 'bob', age: 30 },
  { name: 'charlie', age: 35 }
];

// Find by function
find(users, function(user) { return user.age > 30; });
// => { name: 'charlie', age: 35 }

// Find by property match
find(users, { name: 'bob' });
// => { name: 'bob', age: 30 }

// Find by property value
find(users, 'name', 'alice');
// => { name: 'alice', age: 25 }

Each (forEach)

Iterates over elements of collection invoking iteratee for each element.

/**
 * Iterates over elements of `collection` invoking `iteratee` for each element.
 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
 * (value, index|key, collection).
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `iteratee`.
 * @returns {Array|Object|string} Returns `collection`.
 */
function forEach(collection, iteratee, thisArg);

Every

Checks if predicate returns truthy for all elements of collection.

/**
 * Checks if `predicate` returns truthy for **all** elements of `collection`.
 * The predicate is bound to `thisArg` and invoked with three arguments:
 * (value, index|key, collection).
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `predicate`.
 * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
 */
function every(collection, predicate, thisArg);

Some

Checks if predicate returns truthy for any element of collection.

/**
 * Checks if `predicate` returns truthy for **any** element of `collection`.
 * The predicate is bound to `thisArg` and invoked with three arguments:
 * (value, index|key, collection).
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `predicate`.
 * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
 */
function some(collection, predicate, thisArg);

GroupBy

Creates an object composed of keys generated from the results of running each element through iteratee.

/**
 * Creates an object composed of keys generated from the results of running
 * each element of `collection` through `iteratee`. The corresponding value
 * of each key is an array of the elements responsible for generating the key.
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `iteratee`.
 * @returns {Object} Returns the composed aggregate object.
 */
function groupBy(collection, iteratee, thisArg);

Usage Examples:

var groupBy = require('lodash.groupby');

// Group by length
groupBy(['one', 'two', 'three'], 'length');
// => { '3': ['one', 'two'], '5': ['three'] }

// Group by Math.floor
groupBy([6.1, 4.2, 6.3], function(n) { return Math.floor(n); });
// => { '4': [4.2], '6': [6.1, 6.3] }

SortBy

Creates an array of elements, sorted in ascending order by the results of running each element through iteratee.

/**
 * Creates an array of elements, sorted in ascending order by the results of
 * running each element in a collection through `iteratee`. This method performs
 * a stable sort, that is, it preserves the original sort order of equal elements.
 *
 * @param {Array|Object|string} collection The collection to iterate over.
 * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
 * @param {*} [thisArg] The `this` binding of `iteratee`.
 * @returns {Array} Returns the new sorted array.
 */
function sortBy(collection, iteratee, thisArg);

Usage Examples:

var sortBy = require('lodash.sortby');

var users = [
  { name: 'charlie', age: 40 },
  { name: 'alice', age: 30 },
  { name: 'bob', age: 35 }
];

// Sort by property
sortBy(users, 'age');
// => [{ name: 'alice', age: 30 }, { name: 'bob', age: 35 }, { name: 'charlie', age: 40 }]

// Sort by function
sortBy(users, function(user) { return user.name; });
// => [{ name: 'alice', age: 30 }, { name: 'bob', age: 35 }, { name: 'charlie', age: 40 }]

Additional Functions

The collection category also includes: at, countBy, findLast, findWhere, forEachRight, includes, indexBy, invoke, max, min, partition, pluck, reduceRight, reject, sample, shuffle, size, where

Package Installation:

npm install lodash.map lodash.filter lodash.reduce lodash.find
npm install lodash.foreach lodash.every lodash.some lodash.groupby
npm install lodash.sortby

docs

array-functions.md

collection-functions.md

function-utilities.md

index.md

object-functions.md

type-checking.md

tile.json