CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-lodash-es

Lodash utility library exported as ES6 modules for modern JavaScript applications with tree-shaking support.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

number.mddocs/

Number Functions

Number manipulation utilities for clamping, range checking, and random number generation.

Capabilities

Number Validation and Constraints

/**
 * Clamps number within the inclusive lower and upper bounds
 * @param {number} number - The number to clamp
 * @param {number} lower - The lower bound
 * @param {number} upper - The upper bound
 * @returns {number} Returns the clamped number
 */
function clamp(number, lower, upper);

/**
 * Checks if n is between start and up to, but not including, end
 * @param {number} number - The number to check
 * @param {number} start - The start of the range
 * @param {number} end - The end of the range
 * @returns {boolean} Returns true if number is in the range, else false
 */
function inRange(number, start, end);

Random Number Generation

/**
 * Produces a random number between the inclusive lower and upper bounds
 * @param {number} lower - The lower bound
 * @param {number} upper - The upper bound  
 * @param {boolean} floating - Specify returning a floating-point number
 * @returns {number} Returns the random number
 */
function random(lower, upper, floating);

Usage Examples

import { clamp, inRange, random } from "lodash-es";

// Clamp values within bounds
console.log(clamp(10, 5, 15)); // 10 (within bounds)
console.log(clamp(3, 5, 15)); // 5 (clamped to lower)
console.log(clamp(20, 5, 15)); // 15 (clamped to upper)

// Check if number is in range
console.log(inRange(3, 2, 4)); // true
console.log(inRange(4, 8)); // true (0 to 8)
console.log(inRange(4, 2)); // false
console.log(inRange(2, 2)); // false
console.log(inRange(-3, 2, 4)); // false

// Generate random numbers
console.log(random(0, 5)); // Random integer between 0-5
console.log(random(5)); // Random integer between 0-5
console.log(random(1.2, 5.2)); // Random float between 1.2-5.2
console.log(random()); // Random float between 0-1

docs

array.md

collection.md

date.md

function.md

index.md

lang.md

math.md

number.md

object.md

seq.md

string.md

util.md

tile.json