New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

require-one

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-one

Require the first found package from an array.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3K
decreased by-31.1%
Maintainers
1
Weekly downloads
 
Created
Source

Require One

Load the first package found from the given array.

API

This works across CommonJS/Node, AMD and with global variables.

CommonJS/Node

var $ = requireOne(['jquery', 'cheerio']);
// => jQuery or Cheerio, depending on which one is loaded first.

AMD

require(['require-one'], function(requireOne) {

  // Retrieve the first package that is available.
  var $ = requireOne(["jquery", "cheerio"]);
  // => jQuery or Cheerio, depending on which one is loaded first.

  // ...
});

Globals

<!DOCTYPE html>
<html>
    <head>
        <title>My Sample Project</title>
        <script type="text/javascript" src="../require-one.js"></script>
    </head>
    <body>
        <h1>My Sample Project</h1>
    </body>
</html>

Keywords

FAQs

Package last updated on 30 May 2015

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