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

function-utilities.mddocs/

Function Utilities

Higher-order functions for controlling execution, binding context, and creating specialized functions. These utilities enable advanced functional programming patterns and performance optimizations.

Capabilities

Debounce

Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked.

/**
 * Creates a debounced function that delays invoking `func` until after `wait`
 * milliseconds have elapsed since the last time the debounced function was
 * invoked. The debounced function comes with a `cancel` method to cancel
 * delayed invocations and a `flush` method to immediately invoke them.
 *
 * @param {Function} func The function to debounce.
 * @param {number} [wait=0] The number of milliseconds to delay.
 * @param {Object} [options={}] The options object.
 * @param {boolean} [options.leading=false] Specify invoking on the leading edge of the timeout.
 * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's invoked.
 * @param {boolean} [options.trailing=true] Specify invoking on the trailing edge of the timeout.
 * @returns {Function} Returns the new debounced function.
 */
function debounce(func, wait, options);

Usage Examples:

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

// Avoid costly calculations while the window size is in flux
var lazyLayout = debounce(calculateLayout, 150);
window.addEventListener('resize', lazyLayout);

// Invoke on leading edge
var leadingDebounce = debounce(updateStatus, 200, { leading: true });

// Cancel debounced function
var debounced = debounce(save, 1000);
// Later cancel the call
debounced.cancel();

// Immediately invoke
debounced.flush();

Throttle

Creates a throttled function that only invokes func at most once per every wait milliseconds.

/**
 * Creates a throttled function that only invokes `func` at most once per
 * every `wait` milliseconds. The throttled function comes with a `cancel`
 * method to cancel delayed invocations and a `flush` method to immediately
 * invoke them.
 *
 * @param {Function} func The function to throttle.
 * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
 * @param {Object} [options={}] The options object.
 * @param {boolean} [options.leading=true] Specify invoking on the leading edge of the timeout.
 * @param {boolean} [options.trailing=true] Specify invoking on the trailing edge of the timeout.
 * @returns {Function} Returns the new throttled function.
 */
function throttle(func, wait, options);

Usage Examples:

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

// Avoid excessive scroll handler calls
var throttledScroll = throttle(updateScrollPosition, 100);
window.addEventListener('scroll', throttledScroll);

// Throttle with options
var throttled = throttle(fetchData, 300, { leading: false });

Once

Creates a function that is restricted to invoking func once.

/**
 * Creates a function that is restricted to invoking `func` once. Repeat calls
 * to the function return the value of the first call. The `func` is invoked
 * with the `this` binding and arguments of the created function.
 *
 * @param {Function} func The function to restrict.
 * @returns {Function} Returns the new restricted function.
 */
function once(func);

Usage Examples:

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

var initialize = once(function() {
  console.log('App initialized');
  // expensive initialization logic
});

initialize(); // 'App initialized'
initialize(); // no output, function not called again

Bind

Creates a function that invokes func with the this binding of thisArg and prepends any additional arguments.

/**
 * Creates a function that invokes `func` with the `this` binding of `thisArg`
 * and prepends any additional `bind` arguments to those provided to the bound function.
 *
 * @param {Function} func The function to bind.
 * @param {*} thisArg The `this` binding of `func`.
 * @param {...*} [partials] The arguments to be partially applied.
 * @returns {Function} Returns the new bound function.
 */
function bind(func, thisArg, ...partials);

Usage Examples:

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

function greet(greeting, punctuation) {
  return greeting + ' ' + this.user + punctuation;
}

var object = { user: 'alice' };

// Bind with context
var boundGreet = bind(greet, object);
boundGreet('hello', '!');
// => 'hello alice!'

// Bind with context and partial arguments
var boundSayHello = bind(greet, object, 'hello');
boundSayHello('!');
// => 'hello alice!'

Curry

Creates a function that accepts arguments of func and either invokes func returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining arguments.

/**
 * Creates a function that accepts arguments of `func` and either invokes
 * `func` returning its result, if at least `arity` number of arguments have
 * been provided, or returns a function that accepts the remaining `func`
 * arguments, and so on.
 *
 * @param {Function} func The function to curry.
 * @param {number} [arity=func.length] The arity of `func`.
 * @returns {Function} Returns the new curried function.
 */
function curry(func, arity);

Usage Examples:

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

var abc = function(a, b, c) {
  return [a, b, c];
};

var curried = curry(abc);

curried(1)(2)(3);
// => [1, 2, 3]

curried(1, 2)(3);
// => [1, 2, 3]

curried(1, 2, 3);
// => [1, 2, 3]

Partial

Creates a function that invokes func with partials prepended to the arguments it receives.

/**
 * Creates a function that invokes `func` with `partials` prepended to the
 * arguments it receives. This method is like `_.bind` except it does **not**
 * alter the `this` binding.
 *
 * @param {Function} func The function to partially apply arguments to.
 * @param {...*} [partials] The arguments to be partially applied.
 * @returns {Function} Returns the new partially applied function.
 */
function partial(func, ...partials);

Usage Examples:

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

function greet(greeting, name) {
  return greeting + ' ' + name;
}

var sayHelloTo = partial(greet, 'hello');
sayHelloTo('alice');
// => 'hello alice'

// Use placeholders
var greetFred = partial(greet, _, 'fred');
greetFred('hi');
// => 'hi fred'

Memoize

Creates a function that memoizes the result of func.

/**
 * Creates a function that memoizes the result of `func`. If `resolver` is
 * provided it determines the cache key for storing the result based on the
 * arguments provided to the memoized function. By default, the first argument
 * provided to the memoized function is used as the map cache key.
 *
 * @param {Function} func The function to have its output memoized.
 * @param {Function} [resolver] The function to resolve the cache key.
 * @returns {Function} Returns the new memoizing function.
 */
function memoize(func, resolver);

Usage Examples:

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

var fibonacci = memoize(function(n) {
  return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
});

fibonacci(10); // Computed once
fibonacci(10); // Retrieved from cache

// Custom resolver
var memoized = memoize(expensiveFunction, function(obj) {
  return obj.id;
});

Delay

Invokes func after wait milliseconds.

/**
 * Invokes `func` after `wait` milliseconds. Any additional arguments are
 * provided to `func` when it's invoked.
 *
 * @param {Function} func The function to delay.
 * @param {number} wait The number of milliseconds to delay invocation.
 * @param {...*} [args] The arguments to invoke `func` with.
 * @returns {number} Returns the timer id.
 */
function delay(func, wait, ...args);

Usage Examples:

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

delay(function(text) {
  console.log(text);
}, 1000, 'later');
// => logs 'later' after one second

Defer

Defers invoking the func until the current call stack has cleared.

/**
 * Defers invoking the `func` until the current call stack has cleared. Any
 * additional arguments are provided to `func` when it's invoked.
 *
 * @param {Function} func The function to defer.
 * @param {...*} [args] The arguments to invoke `func` with.
 * @returns {number} Returns the timer id.
 */
function defer(func, ...args);

Usage Examples:

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

defer(function(text) {
  console.log(text);
}, 'deferred');
// logs 'deferred' after the current call stack has cleared

Additional Functions

The function utilities category also includes: after, ary, before, bindAll, bindKey, curryRight, flow, flowRight, negate, partialRight, rearg, wrap

Package Installation:

npm install lodash.debounce lodash.throttle lodash.once lodash.bind
npm install lodash.curry lodash.partial lodash.memoize lodash.delay
npm install lodash.defer

docs

array-functions.md

collection-functions.md

function-utilities.md

index.md

object-functions.md

type-checking.md

tile.json