mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 21:14:45 +00:00
.
This commit is contained in:
parent
fc725ba36b
commit
422b9fdb15
7395 changed files with 1786235 additions and 3476 deletions
21
node_modules/snapdragon-node/LICENSE
generated
vendored
Normal file
21
node_modules/snapdragon-node/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017, Jon Schlinkert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
453
node_modules/snapdragon-node/README.md
generated
vendored
Normal file
453
node_modules/snapdragon-node/README.md
generated
vendored
Normal file
|
@ -0,0 +1,453 @@
|
|||
# snapdragon-node [](https://www.npmjs.com/package/snapdragon-node) [](https://npmjs.org/package/snapdragon-node) [](https://npmjs.org/package/snapdragon-node) [](https://travis-ci.org/jonschlinkert/snapdragon-node)
|
||||
|
||||
> Snapdragon utility for creating a new AST node in custom code, such as plugins.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save snapdragon-node
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
With [snapdragon](https://github.com/jonschlinkert/snapdragon) v0.9.0 and higher you can use `this.node()` to create a new `Node`, whenever it makes sense.
|
||||
|
||||
```js
|
||||
var Node = require('snapdragon-node');
|
||||
var Snapdragon = require('snapdragon');
|
||||
var snapdragon = new Snapdragon();
|
||||
|
||||
// example usage inside a parser visitor function
|
||||
snapdragon.parser.set('foo', function() {
|
||||
// get the current "start" position
|
||||
var pos = this.position();
|
||||
|
||||
// returns the match if regex matches the substring
|
||||
// at the current position on `parser.input`
|
||||
var match = this.match(/foo/);
|
||||
if (match) {
|
||||
// call "pos" on the node, to set the start and end
|
||||
// positions, and return the node to push it onto the AST
|
||||
// (snapdragon will push the node onto the correct
|
||||
// nodes array, based on the stack)
|
||||
return pos(new Node({type: 'bar', val: match[0]}));
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### [Node](index.js#L22)
|
||||
|
||||
Create a new AST `Node` with the given `val` and `type`.
|
||||
|
||||
**Params**
|
||||
|
||||
* `val` **{String|Object}**: Pass a matched substring, or an object to merge onto the node.
|
||||
* `type` **{String}**: The node type to use when `val` is a string.
|
||||
* `returns` **{Object}**: node instance
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var node = new Node('*', 'Star');
|
||||
var node = new Node({type: 'star', val: '*'});
|
||||
```
|
||||
|
||||
### [.isNode](index.js#L61)
|
||||
|
||||
Returns true if the given value is a node.
|
||||
|
||||
**Params**
|
||||
|
||||
* `node` **{Object}**
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var Node = require('snapdragon-node');
|
||||
var node = new Node({type: 'foo'});
|
||||
console.log(Node.isNode(node)); //=> true
|
||||
console.log(Node.isNode({})); //=> false
|
||||
```
|
||||
|
||||
### [.define](index.js#L80)
|
||||
|
||||
Define a non-enumberable property on the node instance. Useful for adding properties that shouldn't be extended or visible during debugging.
|
||||
|
||||
**Params**
|
||||
|
||||
* `name` **{String}**
|
||||
* `val` **{any}**
|
||||
* `returns` **{Object}**: returns the node instance
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var node = new Node();
|
||||
node.define('foo', 'something non-enumerable');
|
||||
```
|
||||
|
||||
### [.isEmpty](index.js#L100)
|
||||
|
||||
Returns true if `node.val` is an empty string, or `node.nodes` does not contain any non-empty text nodes.
|
||||
|
||||
**Params**
|
||||
|
||||
* `fn` **{Function}**: (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes.
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var node = new Node({type: 'text'});
|
||||
node.isEmpty(); //=> true
|
||||
node.val = 'foo';
|
||||
node.isEmpty(); //=> false
|
||||
```
|
||||
|
||||
### [.push](index.js#L118)
|
||||
|
||||
Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and set `foo` as `bar.parent`.
|
||||
|
||||
**Params**
|
||||
|
||||
* `node` **{Object}**
|
||||
* `returns` **{Number}**: Returns the length of `node.nodes`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
foo.push(bar);
|
||||
```
|
||||
|
||||
### [.unshift](index.js#L140)
|
||||
|
||||
Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and set `foo` as `bar.parent`.
|
||||
|
||||
**Params**
|
||||
|
||||
* `node` **{Object}**
|
||||
* `returns` **{Number}**: Returns the length of `node.nodes`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
foo.unshift(bar);
|
||||
```
|
||||
|
||||
### [.pop](index.js#L167)
|
||||
|
||||
Pop a node from `node.nodes`.
|
||||
|
||||
* `returns` **{Number}**: Returns the popped `node`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var node = new Node({type: 'foo'});
|
||||
node.push(new Node({type: 'a'}));
|
||||
node.push(new Node({type: 'b'}));
|
||||
node.push(new Node({type: 'c'}));
|
||||
node.push(new Node({type: 'd'}));
|
||||
console.log(node.nodes.length);
|
||||
//=> 4
|
||||
node.pop();
|
||||
console.log(node.nodes.length);
|
||||
//=> 3
|
||||
```
|
||||
|
||||
### [.shift](index.js#L190)
|
||||
|
||||
Shift a node from `node.nodes`.
|
||||
|
||||
* `returns` **{Object}**: Returns the shifted `node`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var node = new Node({type: 'foo'});
|
||||
node.push(new Node({type: 'a'}));
|
||||
node.push(new Node({type: 'b'}));
|
||||
node.push(new Node({type: 'c'}));
|
||||
node.push(new Node({type: 'd'}));
|
||||
console.log(node.nodes.length);
|
||||
//=> 4
|
||||
node.shift();
|
||||
console.log(node.nodes.length);
|
||||
//=> 3
|
||||
```
|
||||
|
||||
### [.remove](index.js#L205)
|
||||
|
||||
Remove `node` from `node.nodes`.
|
||||
|
||||
**Params**
|
||||
|
||||
* `node` **{Object}**
|
||||
* `returns` **{Object}**: Returns the removed node.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
node.remove(childNode);
|
||||
```
|
||||
|
||||
### [.find](index.js#L231)
|
||||
|
||||
Get the first child node from `node.nodes` that matches the given `type`. If `type` is a number, the child node at that index is returned.
|
||||
|
||||
**Params**
|
||||
|
||||
* `type` **{String}**
|
||||
* `returns` **{Object}**: Returns a child node or undefined.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var child = node.find(1); //<= index of the node to get
|
||||
var child = node.find('foo'); //<= node.type of a child node
|
||||
var child = node.find(/^(foo|bar)$/); //<= regex to match node.type
|
||||
var child = node.find(['foo', 'bar']); //<= array of node.type(s)
|
||||
```
|
||||
|
||||
### [.isType](index.js#L249)
|
||||
|
||||
Return true if the node is the given `type`.
|
||||
|
||||
**Params**
|
||||
|
||||
* `type` **{String}**
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var node = new Node({type: 'bar'});
|
||||
cosole.log(node.isType('foo')); // false
|
||||
cosole.log(node.isType(/^(foo|bar)$/)); // true
|
||||
cosole.log(node.isType(['foo', 'bar'])); // true
|
||||
```
|
||||
|
||||
### [.hasType](index.js#L270)
|
||||
|
||||
Return true if the `node.nodes` has the given `type`.
|
||||
|
||||
**Params**
|
||||
|
||||
* `type` **{String}**
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
foo.push(bar);
|
||||
|
||||
cosole.log(foo.hasType('qux')); // false
|
||||
cosole.log(foo.hasType(/^(qux|bar)$/)); // true
|
||||
cosole.log(foo.hasType(['qux', 'bar'])); // true
|
||||
```
|
||||
|
||||
* `returns` **{Array}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
|
||||
console.log(bar.siblings.length) // 2
|
||||
console.log(baz.siblings.length) // 2
|
||||
```
|
||||
|
||||
* `returns` **{Number}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
var qux = new Node({type: 'qux'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
foo.unshift(qux);
|
||||
|
||||
console.log(bar.index) // 1
|
||||
console.log(baz.index) // 2
|
||||
console.log(qux.index) // 0
|
||||
```
|
||||
|
||||
* `returns` **{Object}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
|
||||
console.log(baz.prev.type) // 'bar'
|
||||
```
|
||||
|
||||
* `returns` **{Object}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
|
||||
console.log(bar.siblings.length) // 2
|
||||
console.log(baz.siblings.length) // 2
|
||||
```
|
||||
|
||||
* `returns` **{Object}**: The first node, or undefiend
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
var qux = new Node({type: 'qux'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
foo.push(qux);
|
||||
|
||||
console.log(foo.first.type) // 'bar'
|
||||
```
|
||||
|
||||
* `returns` **{Object}**: The last node, or undefiend
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
var qux = new Node({type: 'qux'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
foo.push(qux);
|
||||
|
||||
console.log(foo.last.type) // 'qux'
|
||||
```
|
||||
|
||||
* `returns` **{Object}**: The last node, or undefiend
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var foo = new Node({type: 'foo'});
|
||||
var bar = new Node({type: 'bar'});
|
||||
var baz = new Node({type: 'baz'});
|
||||
var qux = new Node({type: 'qux'});
|
||||
foo.push(bar);
|
||||
foo.push(baz);
|
||||
foo.push(qux);
|
||||
|
||||
console.log(foo.last.type) // 'qux'
|
||||
```
|
||||
|
||||
## Release history
|
||||
|
||||
Changelog entries are classified using the following labels from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog):
|
||||
|
||||
* `added`: for new features
|
||||
* `changed`: for changes in existing functionality
|
||||
* `deprecated`: for once-stable features removed in upcoming releases
|
||||
* `removed`: for deprecated features removed in this release
|
||||
* `fixed`: for any bug fixes
|
||||
|
||||
Custom labels used in this changelog:
|
||||
|
||||
* `dependencies`: bumps dependencies
|
||||
* `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories.
|
||||
|
||||
### [2.0.0] - 2017-05-01
|
||||
|
||||
**Changed**
|
||||
|
||||
* `.unshiftNode` was renamed to [.unshift](#unshift)
|
||||
* `.pushNode` was renamed to [.push](#push)
|
||||
* `.getNode` was renamed to [.find](#find)
|
||||
|
||||
**Added**
|
||||
|
||||
* [.isNode](#isNode)
|
||||
* [.isEmpty](#isEmpty)
|
||||
* [.pop](#pop)
|
||||
* [.shift](#shift)
|
||||
* [.remove](#remove)
|
||||
|
||||
### [0.1.0]
|
||||
|
||||
First release.
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [breakdance](https://www.npmjs.com/package/breakdance): Breakdance is a node.js library for converting HTML to markdown. Highly pluggable, flexible and easy… [more](http://breakdance.io) | [homepage](http://breakdance.io "Breakdance is a node.js library for converting HTML to markdown. Highly pluggable, flexible and easy to use. It's time for your markup to get down.")
|
||||
* [snapdragon-capture](https://www.npmjs.com/package/snapdragon-capture): Snapdragon plugin that adds a capture method to the parser instance. | [homepage](https://github.com/jonschlinkert/snapdragon-capture "Snapdragon plugin that adds a capture method to the parser instance.")
|
||||
* [snapdragon-cheerio](https://www.npmjs.com/package/snapdragon-cheerio): Snapdragon plugin for converting a cheerio AST to a snapdragon AST. | [homepage](https://github.com/jonschlinkert/snapdragon-cheerio "Snapdragon plugin for converting a cheerio AST to a snapdragon AST.")
|
||||
* [snapdragon-util](https://www.npmjs.com/package/snapdragon-util): Utilities for the snapdragon parser/compiler. | [homepage](https://github.com/jonschlinkert/snapdragon-util "Utilities for the snapdragon parser/compiler.")
|
||||
* [snapdragon](https://www.npmjs.com/package/snapdragon): Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map… [more](https://github.com/jonschlinkert/snapdragon) | [homepage](https://github.com/jonschlinkert/snapdragon "Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map support.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 25, 2017._
|
492
node_modules/snapdragon-node/index.js
generated
vendored
Normal file
492
node_modules/snapdragon-node/index.js
generated
vendored
Normal file
|
@ -0,0 +1,492 @@
|
|||
'use strict';
|
||||
|
||||
var isObject = require('isobject');
|
||||
var define = require('define-property');
|
||||
var utils = require('snapdragon-util');
|
||||
var ownNames;
|
||||
|
||||
/**
|
||||
* Create a new AST `Node` with the given `val` and `type`.
|
||||
*
|
||||
* ```js
|
||||
* var node = new Node('*', 'Star');
|
||||
* var node = new Node({type: 'star', val: '*'});
|
||||
* ```
|
||||
* @name Node
|
||||
* @param {String|Object} `val` Pass a matched substring, or an object to merge onto the node.
|
||||
* @param {String} `type` The node type to use when `val` is a string.
|
||||
* @return {Object} node instance
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Node(val, type, parent) {
|
||||
if (typeof type !== 'string') {
|
||||
parent = type;
|
||||
type = null;
|
||||
}
|
||||
|
||||
define(this, 'parent', parent);
|
||||
define(this, 'isNode', true);
|
||||
define(this, 'expect', null);
|
||||
|
||||
if (typeof type !== 'string' && isObject(val)) {
|
||||
lazyKeys();
|
||||
var keys = Object.keys(val);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
if (ownNames.indexOf(key) === -1) {
|
||||
this[key] = val[key];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.type = type;
|
||||
this.val = val;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given value is a node.
|
||||
*
|
||||
* ```js
|
||||
* var Node = require('snapdragon-node');
|
||||
* var node = new Node({type: 'foo'});
|
||||
* console.log(Node.isNode(node)); //=> true
|
||||
* console.log(Node.isNode({})); //=> false
|
||||
* ```
|
||||
* @param {Object} `node`
|
||||
* @returns {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.isNode = function(node) {
|
||||
return utils.isNode(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a non-enumberable property on the node instance.
|
||||
* Useful for adding properties that shouldn't be extended
|
||||
* or visible during debugging.
|
||||
*
|
||||
* ```js
|
||||
* var node = new Node();
|
||||
* node.define('foo', 'something non-enumerable');
|
||||
* ```
|
||||
* @param {String} `name`
|
||||
* @param {any} `val`
|
||||
* @return {Object} returns the node instance
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.define = function(name, val) {
|
||||
define(this, name, val);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if `node.val` is an empty string, or `node.nodes` does
|
||||
* not contain any non-empty text nodes.
|
||||
*
|
||||
* ```js
|
||||
* var node = new Node({type: 'text'});
|
||||
* node.isEmpty(); //=> true
|
||||
* node.val = 'foo';
|
||||
* node.isEmpty(); //=> false
|
||||
* ```
|
||||
* @param {Function} `fn` (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes.
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.isEmpty = function(fn) {
|
||||
return utils.isEmpty(this, fn);
|
||||
};
|
||||
|
||||
/**
|
||||
* Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and
|
||||
* set `foo` as `bar.parent`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* foo.push(bar);
|
||||
* ```
|
||||
* @param {Object} `node`
|
||||
* @return {Number} Returns the length of `node.nodes`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.push = function(node) {
|
||||
assert(Node.isNode(node), 'expected node to be an instance of Node');
|
||||
define(node, 'parent', this);
|
||||
|
||||
this.nodes = this.nodes || [];
|
||||
return this.nodes.push(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and
|
||||
* set `foo` as `bar.parent`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* foo.unshift(bar);
|
||||
* ```
|
||||
* @param {Object} `node`
|
||||
* @return {Number} Returns the length of `node.nodes`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.unshift = function(node) {
|
||||
assert(Node.isNode(node), 'expected node to be an instance of Node');
|
||||
define(node, 'parent', this);
|
||||
|
||||
this.nodes = this.nodes || [];
|
||||
return this.nodes.unshift(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pop a node from `node.nodes`.
|
||||
*
|
||||
* ```js
|
||||
* var node = new Node({type: 'foo'});
|
||||
* node.push(new Node({type: 'a'}));
|
||||
* node.push(new Node({type: 'b'}));
|
||||
* node.push(new Node({type: 'c'}));
|
||||
* node.push(new Node({type: 'd'}));
|
||||
* console.log(node.nodes.length);
|
||||
* //=> 4
|
||||
* node.pop();
|
||||
* console.log(node.nodes.length);
|
||||
* //=> 3
|
||||
* ```
|
||||
* @return {Number} Returns the popped `node`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.pop = function() {
|
||||
return this.nodes && this.nodes.pop();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shift a node from `node.nodes`.
|
||||
*
|
||||
* ```js
|
||||
* var node = new Node({type: 'foo'});
|
||||
* node.push(new Node({type: 'a'}));
|
||||
* node.push(new Node({type: 'b'}));
|
||||
* node.push(new Node({type: 'c'}));
|
||||
* node.push(new Node({type: 'd'}));
|
||||
* console.log(node.nodes.length);
|
||||
* //=> 4
|
||||
* node.shift();
|
||||
* console.log(node.nodes.length);
|
||||
* //=> 3
|
||||
* ```
|
||||
* @return {Object} Returns the shifted `node`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.shift = function() {
|
||||
return this.nodes && this.nodes.shift();
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove `node` from `node.nodes`.
|
||||
*
|
||||
* ```js
|
||||
* node.remove(childNode);
|
||||
* ```
|
||||
* @param {Object} `node`
|
||||
* @return {Object} Returns the removed node.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.remove = function(node) {
|
||||
assert(Node.isNode(node), 'expected node to be an instance of Node');
|
||||
this.nodes = this.nodes || [];
|
||||
var idx = node.index;
|
||||
if (idx !== -1) {
|
||||
node.index = -1;
|
||||
return this.nodes.splice(idx, 1);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the first child node from `node.nodes` that matches the given `type`.
|
||||
* If `type` is a number, the child node at that index is returned.
|
||||
*
|
||||
* ```js
|
||||
* var child = node.find(1); //<= index of the node to get
|
||||
* var child = node.find('foo'); //<= node.type of a child node
|
||||
* var child = node.find(/^(foo|bar)$/); //<= regex to match node.type
|
||||
* var child = node.find(['foo', 'bar']); //<= array of node.type(s)
|
||||
* ```
|
||||
* @param {String} `type`
|
||||
* @return {Object} Returns a child node or undefined.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.find = function(type) {
|
||||
return utils.findNode(this.nodes, type);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return true if the node is the given `type`.
|
||||
*
|
||||
* ```js
|
||||
* var node = new Node({type: 'bar'});
|
||||
* cosole.log(node.isType('foo')); // false
|
||||
* cosole.log(node.isType(/^(foo|bar)$/)); // true
|
||||
* cosole.log(node.isType(['foo', 'bar'])); // true
|
||||
* ```
|
||||
* @param {String} `type`
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.isType = function(type) {
|
||||
return utils.isType(this, type);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return true if the `node.nodes` has the given `type`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* foo.push(bar);
|
||||
*
|
||||
* cosole.log(foo.hasType('qux')); // false
|
||||
* cosole.log(foo.hasType(/^(qux|bar)$/)); // true
|
||||
* cosole.log(foo.hasType(['qux', 'bar'])); // true
|
||||
* ```
|
||||
* @param {String} `type`
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Node.prototype.hasType = function(type) {
|
||||
return utils.hasType(this, type);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the siblings array, or `null` if it doesn't exist.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
*
|
||||
* console.log(bar.siblings.length) // 2
|
||||
* console.log(baz.siblings.length) // 2
|
||||
* ```
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'siblings', {
|
||||
set: function() {
|
||||
throw new Error('node.siblings is a getter and cannot be defined');
|
||||
},
|
||||
get: function() {
|
||||
return this.parent ? this.parent.nodes : null;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the node's current index from `node.parent.nodes`.
|
||||
* This should always be correct, even when the parent adds nodes.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* var qux = new Node({type: 'qux'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
* foo.unshift(qux);
|
||||
*
|
||||
* console.log(bar.index) // 1
|
||||
* console.log(baz.index) // 2
|
||||
* console.log(qux.index) // 0
|
||||
* ```
|
||||
* @return {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'index', {
|
||||
set: function(index) {
|
||||
define(this, 'idx', index);
|
||||
},
|
||||
get: function() {
|
||||
if (!Array.isArray(this.siblings)) {
|
||||
return -1;
|
||||
}
|
||||
var tok = this.idx !== -1 ? this.siblings[this.idx] : null;
|
||||
if (tok !== this) {
|
||||
this.idx = this.siblings.indexOf(this);
|
||||
}
|
||||
return this.idx;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the previous node from the siblings array or `null`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
*
|
||||
* console.log(baz.prev.type) // 'bar'
|
||||
* ```
|
||||
* @return {Object}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'prev', {
|
||||
set: function() {
|
||||
throw new Error('node.prev is a getter and cannot be defined');
|
||||
},
|
||||
get: function() {
|
||||
if (Array.isArray(this.siblings)) {
|
||||
return this.siblings[this.index - 1] || this.parent.prev;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the siblings array, or `null` if it doesn't exist.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
*
|
||||
* console.log(bar.siblings.length) // 2
|
||||
* console.log(baz.siblings.length) // 2
|
||||
* ```
|
||||
* @return {Object}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'next', {
|
||||
set: function() {
|
||||
throw new Error('node.next is a getter and cannot be defined');
|
||||
},
|
||||
get: function() {
|
||||
if (Array.isArray(this.siblings)) {
|
||||
return this.siblings[this.index + 1] || this.parent.next;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the first node from `node.nodes`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* var qux = new Node({type: 'qux'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
* foo.push(qux);
|
||||
*
|
||||
* console.log(foo.first.type) // 'bar'
|
||||
* ```
|
||||
* @return {Object} The first node, or undefiend
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'first', {
|
||||
get: function() {
|
||||
return this.nodes ? this.nodes[0] : null;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the last node from `node.nodes`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* var qux = new Node({type: 'qux'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
* foo.push(qux);
|
||||
*
|
||||
* console.log(foo.last.type) // 'qux'
|
||||
* ```
|
||||
* @return {Object} The last node, or undefiend
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'last', {
|
||||
get: function() {
|
||||
return this.nodes ? utils.last(this.nodes) : null;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the last node from `node.nodes`.
|
||||
*
|
||||
* ```js
|
||||
* var foo = new Node({type: 'foo'});
|
||||
* var bar = new Node({type: 'bar'});
|
||||
* var baz = new Node({type: 'baz'});
|
||||
* var qux = new Node({type: 'qux'});
|
||||
* foo.push(bar);
|
||||
* foo.push(baz);
|
||||
* foo.push(qux);
|
||||
*
|
||||
* console.log(foo.last.type) // 'qux'
|
||||
* ```
|
||||
* @return {Object} The last node, or undefiend
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Object.defineProperty(Node.prototype, 'scope', {
|
||||
get: function() {
|
||||
if (this.isScope !== true) {
|
||||
return this.parent ? this.parent.scope : this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get own property names from Node prototype, but only the
|
||||
* first time `Node` is instantiated
|
||||
*/
|
||||
|
||||
function lazyKeys() {
|
||||
if (!ownNames) {
|
||||
ownNames = Object.getOwnPropertyNames(Node.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplified assertion. Throws an error is `val` is falsey.
|
||||
*/
|
||||
|
||||
function assert(val, message) {
|
||||
if (!val) throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `Node`
|
||||
*/
|
||||
|
||||
exports = module.exports = Node;
|
21
node_modules/snapdragon-node/node_modules/define-property/LICENSE
generated
vendored
Normal file
21
node_modules/snapdragon-node/node_modules/define-property/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015, 2017, Jon Schlinkert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
95
node_modules/snapdragon-node/node_modules/define-property/README.md
generated
vendored
Normal file
95
node_modules/snapdragon-node/node_modules/define-property/README.md
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
# define-property [](https://www.npmjs.com/package/define-property) [](https://npmjs.org/package/define-property) [](https://npmjs.org/package/define-property) [](https://travis-ci.org/jonschlinkert/define-property)
|
||||
|
||||
> Define a non-enumerable property on an object.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save define-property
|
||||
```
|
||||
|
||||
Install with [yarn](https://yarnpkg.com):
|
||||
|
||||
```sh
|
||||
$ yarn add define-property
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
**Params**
|
||||
|
||||
* `obj`: The object on which to define the property.
|
||||
* `prop`: The name of the property to be defined or modified.
|
||||
* `descriptor`: The descriptor for the property being defined or modified.
|
||||
|
||||
```js
|
||||
var define = require('define-property');
|
||||
var obj = {};
|
||||
define(obj, 'foo', function(val) {
|
||||
return val.toUpperCase();
|
||||
});
|
||||
|
||||
console.log(obj);
|
||||
//=> {}
|
||||
|
||||
console.log(obj.foo('bar'));
|
||||
//=> 'BAR'
|
||||
```
|
||||
|
||||
**get/set**
|
||||
|
||||
```js
|
||||
define(obj, 'foo', {
|
||||
get: function() {},
|
||||
set: function() {}
|
||||
});
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.")
|
||||
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
|
||||
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
|
||||
* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._
|
31
node_modules/snapdragon-node/node_modules/define-property/index.js
generated
vendored
Normal file
31
node_modules/snapdragon-node/node_modules/define-property/index.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*!
|
||||
* define-property <https://github.com/jonschlinkert/define-property>
|
||||
*
|
||||
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var isDescriptor = require('is-descriptor');
|
||||
|
||||
module.exports = function defineProperty(obj, prop, val) {
|
||||
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
||||
throw new TypeError('expected an object or function.');
|
||||
}
|
||||
|
||||
if (typeof prop !== 'string') {
|
||||
throw new TypeError('expected `prop` to be a string.');
|
||||
}
|
||||
|
||||
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
|
||||
return Object.defineProperty(obj, prop, val);
|
||||
}
|
||||
|
||||
return Object.defineProperty(obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: val
|
||||
});
|
||||
};
|
66
node_modules/snapdragon-node/node_modules/define-property/package.json
generated
vendored
Normal file
66
node_modules/snapdragon-node/node_modules/define-property/package.json
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"name": "define-property",
|
||||
"description": "Define a non-enumerable property on an object.",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://github.com/jonschlinkert/define-property",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/define-property",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/define-property/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-descriptor": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^0.1.12",
|
||||
"mocha": "^3.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"define",
|
||||
"define-property",
|
||||
"enumerable",
|
||||
"key",
|
||||
"non",
|
||||
"non-enumerable",
|
||||
"object",
|
||||
"prop",
|
||||
"property",
|
||||
"value"
|
||||
],
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"extend-shallow",
|
||||
"merge-deep",
|
||||
"assign-deep",
|
||||
"mixin-deep"
|
||||
]
|
||||
},
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz"
|
||||
,"_integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY="
|
||||
,"_from": "define-property@1.0.0"
|
||||
}
|
21
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/LICENSE
generated
vendored
Normal file
21
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
144
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/README.md
generated
vendored
Normal file
144
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/README.md
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
# is-accessor-descriptor [](https://www.npmjs.com/package/is-accessor-descriptor) [](https://npmjs.org/package/is-accessor-descriptor) [](https://npmjs.org/package/is-accessor-descriptor) [](https://travis-ci.org/jonschlinkert/is-accessor-descriptor)
|
||||
|
||||
> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-accessor-descriptor
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isAccessor = require('is-accessor-descriptor');
|
||||
|
||||
isAccessor({get: function() {}});
|
||||
//=> true
|
||||
```
|
||||
|
||||
You may also pass an object and property name to check if the property is an accessor:
|
||||
|
||||
```js
|
||||
isAccessor(foo, 'bar');
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
`false` when not an object
|
||||
|
||||
```js
|
||||
isAccessor('a')
|
||||
isAccessor(null)
|
||||
isAccessor([])
|
||||
//=> false
|
||||
```
|
||||
|
||||
`true` when the object has valid properties
|
||||
|
||||
and the properties all have the correct JavaScript types:
|
||||
|
||||
```js
|
||||
isAccessor({get: noop, set: noop})
|
||||
isAccessor({get: noop})
|
||||
isAccessor({set: noop})
|
||||
//=> true
|
||||
```
|
||||
|
||||
`false` when the object has invalid properties
|
||||
|
||||
```js
|
||||
isAccessor({get: noop, set: noop, bar: 'baz'})
|
||||
isAccessor({get: noop, writable: true})
|
||||
isAccessor({get: noop, value: true})
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when an accessor is not a function
|
||||
|
||||
```js
|
||||
isAccessor({get: noop, set: 'baz'})
|
||||
isAccessor({get: 'foo', set: noop})
|
||||
isAccessor({get: 'foo', bar: 'baz'})
|
||||
isAccessor({get: 'foo', set: 'baz'})
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when a value is not the correct type
|
||||
|
||||
```js
|
||||
isAccessor({get: noop, set: noop, enumerable: 'foo'})
|
||||
isAccessor({set: noop, configurable: 'foo'})
|
||||
isAccessor({get: noop, configurable: 'foo'})
|
||||
//=> false
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.")
|
||||
* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.")
|
||||
* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.")
|
||||
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
|
||||
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 22 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 2 | [realityking](https://github.com/realityking) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 01, 2017._
|
69
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/index.js
generated
vendored
Normal file
69
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/index.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*!
|
||||
* is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
|
||||
*
|
||||
* Copyright (c) 2015-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var typeOf = require('kind-of');
|
||||
|
||||
// accessor descriptor properties
|
||||
var accessor = {
|
||||
get: 'function',
|
||||
set: 'function',
|
||||
configurable: 'boolean',
|
||||
enumerable: 'boolean'
|
||||
};
|
||||
|
||||
function isAccessorDescriptor(obj, prop) {
|
||||
if (typeof prop === 'string') {
|
||||
var val = Object.getOwnPropertyDescriptor(obj, prop);
|
||||
return typeof val !== 'undefined';
|
||||
}
|
||||
|
||||
if (typeOf(obj) !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (has(obj, 'value') || has(obj, 'writable')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!has(obj, 'get') || typeof obj.get !== 'function') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// tldr: it's valid to have "set" be undefined
|
||||
// "set" might be undefined if `Object.getOwnPropertyDescriptor`
|
||||
// was used to get the value, and only `get` was defined by the user
|
||||
if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var key in obj) {
|
||||
if (!accessor.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeOf(obj[key]) === accessor[key]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof obj[key] !== 'undefined') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function has(obj, key) {
|
||||
return {}.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `isAccessorDescriptor`
|
||||
*/
|
||||
|
||||
module.exports = isAccessorDescriptor;
|
77
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/package.json
generated
vendored
Normal file
77
node_modules/snapdragon-node/node_modules/is-accessor-descriptor/package.json
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"name": "is-accessor-descriptor",
|
||||
"description": "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://github.com/jonschlinkert/is-accessor-descriptor",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"Rouven Weßling (www.rouvenwessling.de)"
|
||||
],
|
||||
"repository": "jonschlinkert/is-accessor-descriptor",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-accessor-descriptor/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"accessor",
|
||||
"check",
|
||||
"data",
|
||||
"descriptor",
|
||||
"get",
|
||||
"getter",
|
||||
"is",
|
||||
"keys",
|
||||
"object",
|
||||
"properties",
|
||||
"property",
|
||||
"set",
|
||||
"setter",
|
||||
"type",
|
||||
"valid",
|
||||
"value"
|
||||
],
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"is-accessor-descriptor",
|
||||
"is-data-descriptor",
|
||||
"is-descriptor",
|
||||
"is-plain-object",
|
||||
"isobject"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz"
|
||||
,"_integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ=="
|
||||
,"_from": "is-accessor-descriptor@1.0.0"
|
||||
}
|
21
node_modules/snapdragon-node/node_modules/is-data-descriptor/LICENSE
generated
vendored
Normal file
21
node_modules/snapdragon-node/node_modules/is-data-descriptor/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
161
node_modules/snapdragon-node/node_modules/is-data-descriptor/README.md
generated
vendored
Normal file
161
node_modules/snapdragon-node/node_modules/is-data-descriptor/README.md
generated
vendored
Normal file
|
@ -0,0 +1,161 @@
|
|||
# is-data-descriptor [](https://www.npmjs.com/package/is-data-descriptor) [](https://npmjs.org/package/is-data-descriptor) [](https://npmjs.org/package/is-data-descriptor) [](https://travis-ci.org/jonschlinkert/is-data-descriptor)
|
||||
|
||||
> Returns true if a value has the characteristics of a valid JavaScript data descriptor.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-data-descriptor
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isDataDesc = require('is-data-descriptor');
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
`true` when the descriptor has valid properties with valid values.
|
||||
|
||||
```js
|
||||
// `value` can be anything
|
||||
isDataDesc({value: 'foo'})
|
||||
isDataDesc({value: function() {}})
|
||||
isDataDesc({value: true})
|
||||
//=> true
|
||||
```
|
||||
|
||||
`false` when not an object
|
||||
|
||||
```js
|
||||
isDataDesc('a')
|
||||
//=> false
|
||||
isDataDesc(null)
|
||||
//=> false
|
||||
isDataDesc([])
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when the object has invalid properties
|
||||
|
||||
```js
|
||||
isDataDesc({value: 'foo', bar: 'baz'})
|
||||
//=> false
|
||||
isDataDesc({value: 'foo', bar: 'baz'})
|
||||
//=> false
|
||||
isDataDesc({value: 'foo', get: function(){}})
|
||||
//=> false
|
||||
isDataDesc({get: function(){}, value: 'foo'})
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when a value is not the correct type
|
||||
|
||||
```js
|
||||
isDataDesc({value: 'foo', enumerable: 'foo'})
|
||||
//=> false
|
||||
isDataDesc({value: 'foo', configurable: 'foo'})
|
||||
//=> false
|
||||
isDataDesc({value: 'foo', writable: 'foo'})
|
||||
//=> false
|
||||
```
|
||||
|
||||
## Valid properties
|
||||
|
||||
The only valid data descriptor properties are the following:
|
||||
|
||||
* `configurable` (required)
|
||||
* `enumerable` (required)
|
||||
* `value` (optional)
|
||||
* `writable` (optional)
|
||||
|
||||
To be a valid data descriptor, either `value` or `writable` must be defined.
|
||||
|
||||
**Invalid properties**
|
||||
|
||||
A descriptor may have additional _invalid_ properties (an error will **not** be thrown).
|
||||
|
||||
```js
|
||||
var foo = {};
|
||||
|
||||
Object.defineProperty(foo, 'bar', {
|
||||
enumerable: true,
|
||||
whatever: 'blah', // invalid, but doesn't cause an error
|
||||
get: function() {
|
||||
return 'baz';
|
||||
}
|
||||
});
|
||||
|
||||
console.log(foo.bar);
|
||||
//=> 'baz'
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.")
|
||||
* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.")
|
||||
* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.")
|
||||
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 21 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 2 | [realityking](https://github.com/realityking) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 01, 2017._
|
49
node_modules/snapdragon-node/node_modules/is-data-descriptor/index.js
generated
vendored
Normal file
49
node_modules/snapdragon-node/node_modules/is-data-descriptor/index.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*!
|
||||
* is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
|
||||
*
|
||||
* Copyright (c) 2015-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var typeOf = require('kind-of');
|
||||
|
||||
module.exports = function isDataDescriptor(obj, prop) {
|
||||
// data descriptor properties
|
||||
var data = {
|
||||
configurable: 'boolean',
|
||||
enumerable: 'boolean',
|
||||
writable: 'boolean'
|
||||
};
|
||||
|
||||
if (typeOf(obj) !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof prop === 'string') {
|
||||
var val = Object.getOwnPropertyDescriptor(obj, prop);
|
||||
return typeof val !== 'undefined';
|
||||
}
|
||||
|
||||
if (!('value' in obj) && !('writable' in obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var key in obj) {
|
||||
if (key === 'value') continue;
|
||||
|
||||
if (!data.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeOf(obj[key]) === data[key]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof obj[key] !== 'undefined') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
76
node_modules/snapdragon-node/node_modules/is-data-descriptor/package.json
generated
vendored
Normal file
76
node_modules/snapdragon-node/node_modules/is-data-descriptor/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "is-data-descriptor",
|
||||
"description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://github.com/jonschlinkert/is-data-descriptor",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"Rouven Weßling (www.rouvenwessling.de)"
|
||||
],
|
||||
"repository": "jonschlinkert/is-data-descriptor",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-data-descriptor/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"accessor",
|
||||
"check",
|
||||
"data",
|
||||
"descriptor",
|
||||
"get",
|
||||
"getter",
|
||||
"is",
|
||||
"keys",
|
||||
"object",
|
||||
"properties",
|
||||
"property",
|
||||
"set",
|
||||
"setter",
|
||||
"type",
|
||||
"valid",
|
||||
"value"
|
||||
],
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"is-accessor-descriptor",
|
||||
"is-data-descriptor",
|
||||
"is-descriptor",
|
||||
"isobject"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz"
|
||||
,"_integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ=="
|
||||
,"_from": "is-data-descriptor@1.0.0"
|
||||
}
|
21
node_modules/snapdragon-node/node_modules/is-descriptor/LICENSE
generated
vendored
Normal file
21
node_modules/snapdragon-node/node_modules/is-descriptor/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
193
node_modules/snapdragon-node/node_modules/is-descriptor/README.md
generated
vendored
Normal file
193
node_modules/snapdragon-node/node_modules/is-descriptor/README.md
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
# is-descriptor [](https://www.npmjs.com/package/is-descriptor) [](https://npmjs.org/package/is-descriptor) [](https://npmjs.org/package/is-descriptor) [](https://travis-ci.org/jonschlinkert/is-descriptor)
|
||||
|
||||
> Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-descriptor
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isDescriptor = require('is-descriptor');
|
||||
|
||||
isDescriptor({value: 'foo'})
|
||||
//=> true
|
||||
isDescriptor({get: function(){}, set: function(){}})
|
||||
//=> true
|
||||
isDescriptor({get: 'foo', set: function(){}})
|
||||
//=> false
|
||||
```
|
||||
|
||||
You may also check for a descriptor by passing an object as the first argument and property name (`string`) as the second argument.
|
||||
|
||||
```js
|
||||
var obj = {};
|
||||
obj.foo = 'abc';
|
||||
|
||||
Object.defineProperty(obj, 'bar', {
|
||||
value: 'xyz'
|
||||
});
|
||||
|
||||
isDescriptor(obj, 'foo');
|
||||
//=> true
|
||||
isDescriptor(obj, 'bar');
|
||||
//=> true
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### value type
|
||||
|
||||
`false` when not an object
|
||||
|
||||
```js
|
||||
isDescriptor('a');
|
||||
//=> false
|
||||
isDescriptor(null);
|
||||
//=> false
|
||||
isDescriptor([]);
|
||||
//=> false
|
||||
```
|
||||
|
||||
### data descriptor
|
||||
|
||||
`true` when the object has valid properties with valid values.
|
||||
|
||||
```js
|
||||
isDescriptor({value: 'foo'});
|
||||
//=> true
|
||||
isDescriptor({value: noop});
|
||||
//=> true
|
||||
```
|
||||
|
||||
`false` when the object has invalid properties
|
||||
|
||||
```js
|
||||
isDescriptor({value: 'foo', bar: 'baz'});
|
||||
//=> false
|
||||
isDescriptor({value: 'foo', bar: 'baz'});
|
||||
//=> false
|
||||
isDescriptor({value: 'foo', get: noop});
|
||||
//=> false
|
||||
isDescriptor({get: noop, value: noop});
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when a value is not the correct type
|
||||
|
||||
```js
|
||||
isDescriptor({value: 'foo', enumerable: 'foo'});
|
||||
//=> false
|
||||
isDescriptor({value: 'foo', configurable: 'foo'});
|
||||
//=> false
|
||||
isDescriptor({value: 'foo', writable: 'foo'});
|
||||
//=> false
|
||||
```
|
||||
|
||||
### accessor descriptor
|
||||
|
||||
`true` when the object has valid properties with valid values.
|
||||
|
||||
```js
|
||||
isDescriptor({get: noop, set: noop});
|
||||
//=> true
|
||||
isDescriptor({get: noop});
|
||||
//=> true
|
||||
isDescriptor({set: noop});
|
||||
//=> true
|
||||
```
|
||||
|
||||
`false` when the object has invalid properties
|
||||
|
||||
```js
|
||||
isDescriptor({get: noop, set: noop, bar: 'baz'});
|
||||
//=> false
|
||||
isDescriptor({get: noop, writable: true});
|
||||
//=> false
|
||||
isDescriptor({get: noop, value: true});
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when an accessor is not a function
|
||||
|
||||
```js
|
||||
isDescriptor({get: noop, set: 'baz'});
|
||||
//=> false
|
||||
isDescriptor({get: 'foo', set: noop});
|
||||
//=> false
|
||||
isDescriptor({get: 'foo', bar: 'baz'});
|
||||
//=> false
|
||||
isDescriptor({get: 'foo', set: 'baz'});
|
||||
//=> false
|
||||
```
|
||||
|
||||
`false` when a value is not the correct type
|
||||
|
||||
```js
|
||||
isDescriptor({get: noop, set: noop, enumerable: 'foo'});
|
||||
//=> false
|
||||
isDescriptor({set: noop, configurable: 'foo'});
|
||||
//=> false
|
||||
isDescriptor({get: noop, configurable: 'foo'});
|
||||
//=> false
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.")
|
||||
* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.")
|
||||
* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.")
|
||||
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 24 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 1 | [doowb](https://github.com/doowb) |
|
||||
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 22, 2017._
|
22
node_modules/snapdragon-node/node_modules/is-descriptor/index.js
generated
vendored
Normal file
22
node_modules/snapdragon-node/node_modules/is-descriptor/index.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*!
|
||||
* is-descriptor <https://github.com/jonschlinkert/is-descriptor>
|
||||
*
|
||||
* Copyright (c) 2015-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var typeOf = require('kind-of');
|
||||
var isAccessor = require('is-accessor-descriptor');
|
||||
var isData = require('is-data-descriptor');
|
||||
|
||||
module.exports = function isDescriptor(obj, key) {
|
||||
if (typeOf(obj) !== 'object') {
|
||||
return false;
|
||||
}
|
||||
if ('get' in obj) {
|
||||
return isAccessor(obj, key);
|
||||
}
|
||||
return isData(obj, key);
|
||||
};
|
79
node_modules/snapdragon-node/node_modules/is-descriptor/package.json
generated
vendored
Normal file
79
node_modules/snapdragon-node/node_modules/is-descriptor/package.json
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"name": "is-descriptor",
|
||||
"description": "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.",
|
||||
"version": "1.0.2",
|
||||
"homepage": "https://github.com/jonschlinkert/is-descriptor",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Brian Woodward (https://twitter.com/doowb)",
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"(https://github.com/wtgtybhertgeghgtwtg)"
|
||||
],
|
||||
"repository": "jonschlinkert/is-descriptor",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-descriptor/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-accessor-descriptor": "^1.0.0",
|
||||
"is-data-descriptor": "^1.0.0",
|
||||
"kind-of": "^6.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"accessor",
|
||||
"check",
|
||||
"data",
|
||||
"descriptor",
|
||||
"get",
|
||||
"getter",
|
||||
"is",
|
||||
"keys",
|
||||
"object",
|
||||
"properties",
|
||||
"property",
|
||||
"set",
|
||||
"setter",
|
||||
"type",
|
||||
"valid",
|
||||
"value"
|
||||
],
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"is-accessor-descriptor",
|
||||
"is-data-descriptor",
|
||||
"is-descriptor",
|
||||
"isobject"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz"
|
||||
,"_integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg=="
|
||||
,"_from": "is-descriptor@1.0.2"
|
||||
}
|
80
node_modules/snapdragon-node/package.json
generated
vendored
Normal file
80
node_modules/snapdragon-node/package.json
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "snapdragon-node",
|
||||
"description": "Snapdragon utility for creating a new AST node in custom code, such as plugins.",
|
||||
"version": "2.1.1",
|
||||
"homepage": "https://github.com/jonschlinkert/snapdragon-node",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/snapdragon-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/snapdragon-node/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"define-property": "^1.0.0",
|
||||
"isobject": "^3.0.0",
|
||||
"snapdragon-util": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-eslint": "^4.0.0",
|
||||
"gulp-format-md": "^0.1.12",
|
||||
"gulp-istanbul": "^1.1.2",
|
||||
"gulp-mocha": "^3.0.1",
|
||||
"mocha": "^3.4.2",
|
||||
"snapdragon": "^0.11.0"
|
||||
},
|
||||
"keywords": [
|
||||
"ast",
|
||||
"compile",
|
||||
"compiler",
|
||||
"convert",
|
||||
"node",
|
||||
"parse",
|
||||
"parser",
|
||||
"plugin",
|
||||
"render",
|
||||
"snapdragon",
|
||||
"snapdragonplugin",
|
||||
"token",
|
||||
"transform"
|
||||
],
|
||||
"verb": {
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"breakdance",
|
||||
"snapdragon",
|
||||
"snapdragon-capture",
|
||||
"snapdragon-cheerio",
|
||||
"snapdragon-util"
|
||||
]
|
||||
},
|
||||
"reflinks": [
|
||||
"verb",
|
||||
"verb-generate-readme"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz"
|
||||
,"_integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw=="
|
||||
,"_from": "snapdragon-node@2.1.1"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue