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

lodash.once

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.once

The lodash method `_.once` exported as a module.

  • 4.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17M
increased by7.85%
Maintainers
3
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 13 Aug 2016

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