Lodash utility library exported as ES6 modules for modern JavaScript applications with tree-shaking support.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Mathematical utilities for arithmetic operations, rounding, and statistical calculations.
/**
* Adds two numbers
* @param {number} augend - The first number in an addition
* @param {number} addend - The second number in an addition
* @returns {number} Returns the total
*/
function add(augend, addend);
/**
* Subtracts two numbers
* @param {number} minuend - The first number in a subtraction
* @param {number} subtrahend - The second number in a subtraction
* @returns {number} Returns the difference
*/
function subtract(minuend, subtrahend);
/**
* Multiplies two numbers
* @param {number} multiplier - The first number in a multiplication
* @param {number} multiplicand - The second number in a multiplication
* @returns {number} Returns the product
*/
function multiply(multiplier, multiplicand);
/**
* Divides two numbers
* @param {number} dividend - The first number in a division
* @param {number} divisor - The second number in a division
* @returns {number} Returns the quotient
*/
function divide(dividend, divisor);/**
* Computes number rounded up to precision
* @param {number} number - The number to round up
* @param {number} precision - The precision to round up to
* @returns {number} Returns the rounded up number
*/
function ceil(number, precision);
/**
* Computes number rounded down to precision
* @param {number} number - The number to round down
* @param {number} precision - The precision to round down to
* @returns {number} Returns the rounded down number
*/
function floor(number, precision);
/**
* Computes number rounded to precision
* @param {number} number - The number to round
* @param {number} precision - The precision to round to
* @returns {number} Returns the rounded number
*/
function round(number, precision);/**
* Computes the maximum value of array
* @param {Array} array - The array to iterate over
* @returns {*} Returns the maximum value
*/
function max(array);
/**
* Like max but accepts iteratee for value comparison
* @param {Array} array - The array to iterate over
* @param {Function} iteratee - The iteratee invoked per element
* @returns {*} Returns the maximum value
*/
function maxBy(array, iteratee);
/**
* Computes the minimum value of array
* @param {Array} array - The array to iterate over
* @returns {*} Returns the minimum value
*/
function min(array);
/**
* Like min but accepts iteratee for value comparison
* @param {Array} array - The array to iterate over
* @param {Function} iteratee - The iteratee invoked per element
* @returns {*} Returns the minimum value
*/
function minBy(array, iteratee);
/**
* Computes the sum of the values in array
* @param {Array} array - The array to iterate over
* @returns {number} Returns the sum
*/
function sum(array);
/**
* Like sum but accepts iteratee for value selection
* @param {Array} array - The array to iterate over
* @param {Function} iteratee - The iteratee invoked per element
* @returns {number} Returns the sum
*/
function sumBy(array, iteratee);
/**
* Computes the mean of the values in array
* @param {Array} array - The array to iterate over
* @returns {number} Returns the mean
*/
function mean(array);
/**
* Like mean but accepts iteratee for value selection
* @param {Array} array - The array to iterate over
* @param {Function} iteratee - The iteratee invoked per element
* @returns {number} Returns the mean
*/
function meanBy(array, iteratee);import { add, subtract, multiply, divide, sum, mean, max, min } from "lodash-es";
// Basic arithmetic
console.log(add(6, 4)); // 10
console.log(subtract(10, 3)); // 7
console.log(multiply(3, 4)); // 12
console.log(divide(12, 3)); // 4
// Array operations
const scores = [85, 92, 78, 96, 88];
console.log(sum(scores)); // 439
console.log(mean(scores)); // 87.8
console.log(max(scores)); // 96
console.log(min(scores)); // 78
// With iteratees
const users = [
{ name: "Alice", score: 85 },
{ name: "Bob", score: 92 },
{ name: "Charlie", score: 78 }
];
console.log(sumBy(users, "score")); // 255
console.log(meanBy(users, "score")); // 85
console.log(maxBy(users, "score")); // { name: "Bob", score: 92 }