2017 © Pedro Peláez
 

component require-one

Loads the first package found in the given array.

image

robloach/require-one

Loads the first package found in the given array.

  • Saturday, December 24, 2016
  • by RobLoach
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Require One NPM version

Build Status NPM downloads Dependency Status, (*1)

Load the first package found from the given array., (*2)

Install

Method Installation
npm npm install require-one --save
component component install robloach/require-one
Composer composer require require-one
Bower bower install require-one

Usage

This works across CommonJS/node, AMD and with global variables for the browser., (*3)

CommonJS

This is an example of loading either jQuery, Zepto, or Cheerio with a CommonJS module loader, like Node.js., (*4)

``` javascript var $ = requireOne('jquery', 'zepto', 'cheerio'); // => jQuery, Zepto or Cheerio, depending on which one is available., (*5)


### AMD This is an example of loading either [jQuery](http://jquery.com), [Zepto](http://zeptojs.com), or [Cheerio](http://cheeriojs.github.io/cheerio) with an AMD module loader, like [Require.js](http://requirejs.org). ``` javascript require(['require-one'], function(requireOne) { // Retrieve the first package that is available. var $ = requireOne('jquery', 'zepto', 'cheerio'); // => jQuery, Zepto or Cheerio, depending on which one is available. // ... });

Globals

This is an example of loading either jQuery, Zepto, or Cheerio without a module loader, i.e. with the browser's global variables., (*6)

html <!DOCTYPE html> <html> <head> <script type="text/javascript" src="path/to/require-one.js"></script> <script> var $ = requireOne('jquery', 'jQuery', 'zepto', 'Zepto', 'cheerio'); // => jQuery, Zepto or Cheerio, depending on which one is available. </script> </head> <body> <h1>My Sample Project</h1> </body> </html>, (*7)

License

MIT, (*8)

The Versions

24/12 2016

dev-master

9999999-dev

Loads the first package found in the given array.

  Sources   Download

MIT

24/12 2016

1.0.3

1.0.3.0

Loads the first package found in the given array.

  Sources   Download

MIT

29/03 2016

1.0.2

1.0.2.0

Loads the first package found in the given array.

  Sources   Download

MIT

26/09 2015

1.0.1

1.0.1.0

Loads the first package found in the given array.

  Sources   Download

MIT

09/07 2015

1.0.0

1.0.0.0

Loads the first package found in the given array.

  Sources   Download

MIT

02/07 2015

0.2.0

0.2.0.0

Loads the first package found in the given array.

  Sources   Download

MIT

22/06 2015

0.1.2

0.1.2.0

Loads the first package found in the given array.

  Sources   Download

MIT