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

undefine

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undefine - npm Package Compare versions

Comparing version

to
0.2.8

README.md~

2

package.json
{
"name": "undefine",
"version": "0.2.7",
"version": "0.2.8",
"description": "Universal Module Loader, for node.js, browser scripts, bundles, and AMD define loaders",

@@ -5,0 +5,0 @@ "main": "undefine.js",

@@ -13,4 +13,13 @@ # Undefine

Stability: Feature complete, used by [toubkal](https://github.com/ReactiveSets/toubkal), needs CI testing.
Stability: Stable, used by [toubkal](https://github.com/ReactiveSets/toubkal).
## Features
- Allows dual dependencies definitions for the browser and node
- Shortest module biolerplate
- Comprehensive, trully works in all situations, unlike UMD which is broken
- Smallest footprint
- Compatible with AMD module loaders such as require.js and curl-amd
- Does not require a build process
## Example

@@ -135,4 +144,4 @@

As an extension to AMD dependencies specification, a dependency may be specified with
an Array of two strings where the first string is the exported name and the second
string is the Node.js module name.
an Array of two strings where the first string is the exported name in the browser and
the second string is a Nodejs module name.

@@ -150,2 +159,20 @@ Example: the following **loggable** module has two dependencies, the first is

Also, if a module is not available on the browser or in node, one can specify a non-string
value, typically falsy, where the module is not available.
Example: Node module **css-select** emulates CSS3 querySelector() method. To use this module
one can apply the following definition for dependencies:
```javascript
( this.undefine || require( 'undefine' )( module, require ) )()
( 'query_selector', [ [ 0, 'css-select' ] ], function( css_select ) {
var selector = '#comments';
return css_select
? css_select.selectOne( selector, [] /* should be an htmlparse2 document or element */ )
: document.querySelector( selector )
;
} )
```
## Licence

@@ -152,0 +179,0 @@

@@ -174,5 +174,9 @@ /* undefine.js

var f = 'require_global()'
, name = disambiguate( dependency ).split( '/' ).pop()
, name = disambiguate( dependency )
;
if ( typeof name != 'string' ) return name; // dependency name is the exported value
name = name.split( '/' ).pop();
de&&ug( f, 'name:', name );

@@ -179,0 +183,0 @@