Comparing version 1.0.1 to 1.0.2
22
index.js
'use strict' | ||
var printf = require('pff') | ||
var ternary = require('ternary') | ||
var isDefined = require('is-defined') | ||
var access = require('accessory') | ||
module.exports = function globalize (id) { | ||
var hasWindow = 'typeof window !== "undefined"' | ||
var hasGlobal = 'typeof global !== "undefined"' | ||
return printf('(%s ? window[\'%s\'] : %s ? global[\'%s\'] : null)', hasWindow, id, hasGlobal, id) | ||
module.exports = function globalize (property) { | ||
return parenthesize(ternary( | ||
isDefined('window'), | ||
access('window', property), | ||
ternary( | ||
isDefined('global'), | ||
access('global', property), | ||
null | ||
) | ||
)) | ||
} | ||
function parenthesize (string) { | ||
return '(' + string + ')' | ||
} |
{ | ||
"name": "globo", | ||
"main": "index.js", | ||
"version": "1.0.1", | ||
"description": "Turn module ids into global lookups that work in Node and the browser", | ||
"version": "1.0.2", | ||
"description": "Turn identifiers into global lookups that work in Node and the browser", | ||
"license": "MIT", | ||
@@ -27,3 +27,5 @@ "repository": "bendrucker/globo", | ||
"dependencies": { | ||
"pff": "~1.0.0" | ||
"accessory": "~1.0.0", | ||
"is-defined": "~1.0.0", | ||
"ternary": "~1.0.0" | ||
}, | ||
@@ -30,0 +32,0 @@ "devDependencies": { |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2851
18
0
3
+ Addedaccessory@~1.0.0
+ Addedis-defined@~1.0.0
+ Addedternary@~1.0.0
+ Addedaccessory@1.0.1(transitive)
+ Addeddot-parts@1.0.1(transitive)
+ Addedis-defined@1.0.0(transitive)
+ Addedternary@1.0.0(transitive)
- Removedpff@~1.0.0
- Removedpff@1.0.0(transitive)