Comparing version
11
index.js
@@ -1,6 +0,5 @@ | ||
'use strict'; | ||
module.exports = function () { | ||
return typeof window !== 'undefined' | ||
&& typeof document !== 'undefined' | ||
&& typeof document.createElement === 'function'; | ||
}; | ||
export default function hasDom() { | ||
return typeof window !== 'undefined' && | ||
typeof document !== 'undefined' && | ||
typeof document.createElement === 'function'; | ||
} |
{ | ||
"name": "has-dom", | ||
"version": "1.0.1", | ||
"description": "Check if a JavaScript environment has a DOM", | ||
"license": "MIT", | ||
"repository": "sindresorhus/has-dom", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"browsers", | ||
"dom", | ||
"js", | ||
"javascript", | ||
"env", | ||
"environment", | ||
"has", | ||
"detect", | ||
"check" | ||
], | ||
"devDependencies": { | ||
"ava": "*" | ||
} | ||
"name": "has-dom", | ||
"version": "2.0.0", | ||
"description": "Check if a JavaScript environment has a DOM", | ||
"license": "MIT", | ||
"repository": "sindresorhus/has-dom", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"browsers", | ||
"dom", | ||
"js", | ||
"javascript", | ||
"env", | ||
"environment", | ||
"has", | ||
"detect", | ||
"check" | ||
], | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"xo": "^0.39.1" | ||
}, | ||
"xo": { | ||
"envs": [ | ||
"node", | ||
"browser" | ||
] | ||
} | ||
} |
@@ -1,17 +0,15 @@ | ||
# has-dom [](https://travis-ci.org/sindresorhus/has-dom) | ||
# has-dom | ||
> Check if a JavaScript environment has a [DOM](http://en.wikipedia.org/wiki/Document_Object_Model) | ||
> Check if a JavaScript environment has a [DOM](https://en.wikipedia.org/wiki/Document_Object_Model) | ||
## Install | ||
``` | ||
$ npm install --save has-dom | ||
$ npm install has-dom | ||
``` | ||
## Usage | ||
```js | ||
var hasDom = require('has-dom'); | ||
import hasDom from 'has-dom'; | ||
@@ -26,6 +24,1 @@ // In Node.js | ||
``` | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
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
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
Yes
NaN2288
-2.97%2
100%5
-16.67%24
-22.58%