Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash.once

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.once

The Lo-Dash function `_.once` as a Node.js module generated by lodash-cli.

  • 2.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16M
decreased by-1.41%
Maintainers
4
Weekly downloads
 
Created

What is lodash.once?

The lodash.once package is a utility that allows you to create a function that can only be called once. After the first call, subsequent calls to the function will return the result of the first call without executing the function again. This is useful for initializing resources or other actions that should only happen once.

What are lodash.once's main functionalities?

Creating a function that can only be called once

This feature allows you to create a function that will only execute its body once and will return the result of the first execution on subsequent calls.

const once = require('lodash.once');
const initialize = once(() => {
  console.log('Initialization complete.');
  return 'Initialized';
});

console.log(initialize()); // Output: Initialization complete.
console.log(initialize()); // Output: Initialized (without logging 'Initialization complete.' again)

Other packages similar to lodash.once

Keywords

FAQs

Package last updated on 11 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc