globals-docs
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -449,5 +449,5 @@ { | ||
"worker": { | ||
"importScripts": true, | ||
"postMessage": true, | ||
"self": true | ||
"importScripts": "https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts", | ||
"postMessage": "https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/postMessage", | ||
"self": "https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/self" | ||
}, | ||
@@ -459,3 +459,3 @@ "node": { | ||
"Buffer": "https://nodejs.org/api/buffer.html", | ||
"clearImmediate": false, | ||
"clearImmediate": "https://nodejs.org/api/timers.html#timers_clearimmediate_immediateobject", | ||
"clearInterval": "https://nodejs.org/api/globals.html#globals_clearinterval_t", | ||
@@ -470,4 +470,4 @@ "clearTimeout": "https://nodejs.org/api/globals.html#globals_cleartimeout_t", | ||
"process": "https://nodejs.org/api/process.html", | ||
"require": false, | ||
"setImmediate": false, | ||
"require": "https://nodejs.org/api/globals.html#globals_require", | ||
"setImmediate": "https://nodejs.org/api/timers.html#timers_setimmediate_callback_arg", | ||
"setInterval": "https://nodejs.org/api/globals.html#globals_setinterval_cb_ms", | ||
@@ -474,0 +474,0 @@ "setTimeout": "https://nodejs.org/api/globals.html#globals_settimeout_cb_ms" |
33
index.js
@@ -1,1 +0,32 @@ | ||
module.exports = require('./globals-docs.json'); | ||
var docs = require('./globals-docs.json'); | ||
/** | ||
* Docs: an object of documentation as a plain-old-javascript object. | ||
* | ||
* Has keys that correspond to environments: | ||
* | ||
* - builtin | ||
* - nonstandard | ||
* - browser | ||
* - worker | ||
* - node | ||
*/ | ||
module.exports.docs = docs; | ||
/** | ||
* Get a URL for a global object. | ||
* | ||
* @param {string} name name of the global object | ||
* @param {Array<string>} env environments that will be reached. By default tries all environments | ||
* @returns {string|undefined} the URL of the documentation resource, if found | ||
* @example | ||
* getDoc('Array'); // yields MDC documentation for Array | ||
*/ | ||
module.exports.getDoc = function(name, env) { | ||
if (!env) env = Object.keys(docs); | ||
for (var i = 0; i < env.length; i++) { | ||
var d = docs[env[i]][name]; | ||
if (d) return d; | ||
} | ||
}; |
{ | ||
"name": "globals-docs", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "documentation links for all node and browser globals", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# globals-docs | ||
[![build status](https://secure.travis-ci.org/documentationjs/globals-docs.png)](http://travis-ci.org/documentationjs/globals-docs) | ||
Documentation URIs for JavaScript globals. | ||
## `docs` | ||
Docs: an object of documentation as a plain-old-javascript object. | ||
Has keys that correspond to environments: | ||
- builtin | ||
- nonstandard | ||
- browser | ||
- worker | ||
- node | ||
## `getDoc` | ||
Get a URL for a global object. | ||
### Parameters | ||
| name | type | description | | ||
| ---- | ---- | ----------- | | ||
| `name` | `string` | name of the global object | | ||
| `env` | `Array<string>` | environments that will be reached. By default tries all environments | | ||
### Examples | ||
```js | ||
getDoc('Array'); // yields MDC documentation for Array | ||
``` | ||
Returns the URL of the documentation resource, if found |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44815
7
502
42
45919