Back
vendored
lodash.noop
v3.0.1
MIT

noop

The standalone lodash.noop package as a vendorable file. Useful when you want a named no-op helper without adding a dependency.

Why copy this?

This page ships the published lodash.noop file in both raw and normalized forms. The value is to preserve a familiar tiny helper locally when existing code already expects it.

Native alternative: An empty arrow function is trivial to write, but vendoring the known helper can still be useful when replacing an existing dependency.

Note: Raw and normalized views are both available. Use normalized when you want an ESM and TypeScript-friendly file, and raw when you want the original published package shape.

This copy is your responsibility once you adopt it. It does not automatically receive upstream bug fixes or security updates.

Snippet
Copy-first distribution
Normalized
ESM / TS / normalized
Runtime: node, bun
/**
 * Derived from [email protected]
 * Rule-based normalized variant generated by this repository.
 * Preserve the upstream license and attribution notices when copying this file.
 */
/**
 * Derived from [email protected]
 * Rule-based normalized variant generated by this repository.
 * See THIRD_PARTY_NOTICES.md for upstream license and attribution details.
 */
/**
 * lodash 3.0.1 (Custom Build) <https://lodash.com/>
 * Build: `lodash modularize include="noop" exports="npm" -o ./foo`
 * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <https://lodash.com/license>
 */

/**
 * A no-operation function that returns `undefined` regardless of the
 * arguments it receives.
 *
 * @static
 * @memberOf _
 * @category Util
 * @example
 *
 * var object = { 'user': 'fred' };
 *
 * _.noop(object) === undefined;
 * // => true
 */
function noop() {
  // No operation performed.
}

export default noop;
Variant note: Rule-based normalization for modern TS projects. The goal is easier import and build compatibility, not changed behavior.
Transforms: module.exports-to-export-default, js-extension-to-ts-extension
Validation: This normalized variant is intended to stay oxlint and oxfmt clean in this repo.
Raw
CJS / JS / raw
Runtime: node, bun
/**
 * lodash 3.0.1 (Custom Build) <https://lodash.com/>
 * Build: `lodash modularize include="noop" exports="npm" -o ./foo`
 * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <https://lodash.com/license>
 */

/**
 * A no-operation function that returns `undefined` regardless of the
 * arguments it receives.
 *
 * @static
 * @memberOf _
 * @category Util
 * @example
 *
 * var object = { 'user': 'fred' };
 *
 * _.noop(object) === undefined;
 * // => true
 */
function noop() {
  // No operation performed.
}

module.exports = noop;
Variant note: Published package file kept as-is for older teams or repos that still prefer the original CommonJS distribution.