init
This commit is contained in:
3
node_modules/is-generator/.npmignore
generated
vendored
Normal file
3
node_modules/is-generator/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
coverage
|
13
node_modules/is-generator/.travis.yml
generated
vendored
Normal file
13
node_modules/is-generator/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
language: node_js
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: change
|
||||
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.12"
|
||||
- "iojs"
|
||||
|
||||
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
|
21
node_modules/is-generator/LICENSE
generated
vendored
Normal file
21
node_modules/is-generator/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||
|
||||
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.
|
47
node_modules/is-generator/README.md
generated
vendored
Normal file
47
node_modules/is-generator/README.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Is Generator
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![NPM downloads][downloads-image]][downloads-url]
|
||||
[![Build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
> Check whether a value is a generator or generator function.
|
||||
|
||||
**Generator:** A specific type of iterator object. [Reference][def-gen].
|
||||
**Generator Function:** A `function*` declaration, returns a generator object. [Reference][def-gen-fn].
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install is-generator --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var isGenerator = require('is-generator')
|
||||
var isGeneratorFn = require('is-generator').fn
|
||||
|
||||
isGenerator(null) //=> false
|
||||
isGenerator(function * () {}) //=> false
|
||||
isGenerator((function * () {})()) //=> true
|
||||
|
||||
isGeneratorFn(null) //=> false
|
||||
isGeneratorFn(function () {}) //=> false
|
||||
isGeneratorFn(function * () {}) //=> true
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/is-generator.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/is-generator
|
||||
[downloads-image]: https://img.shields.io/npm/dm/is-generator.svg?style=flat
|
||||
[downloads-url]: https://npmjs.org/package/is-generator
|
||||
[travis-image]: https://img.shields.io/travis/blakeembrey/is-generator.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/blakeembrey/is-generator
|
||||
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/is-generator.svg?style=flat
|
||||
[coveralls-url]: https://coveralls.io/r/blakeembrey/is-generator?branch=master
|
||||
[def-gen]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator
|
||||
[def-gen-fn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
|
29
node_modules/is-generator/is-generator.js
generated
vendored
Normal file
29
node_modules/is-generator/is-generator.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Export generator function checks.
|
||||
*/
|
||||
module.exports = isGenerator
|
||||
module.exports.fn = isGeneratorFunction
|
||||
|
||||
/**
|
||||
* Check whether an object is a generator.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isGenerator (obj) {
|
||||
return obj &&
|
||||
typeof obj.next === 'function' &&
|
||||
typeof obj.throw === 'function'
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a function is generator.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isGeneratorFunction (fn) {
|
||||
return typeof fn === 'function' &&
|
||||
fn.constructor &&
|
||||
fn.constructor.name === 'GeneratorFunction'
|
||||
}
|
41
node_modules/is-generator/package.json
generated
vendored
Normal file
41
node_modules/is-generator/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "is-generator",
|
||||
"version": "1.0.3",
|
||||
"description": "Check whether a value is a generator or generator function",
|
||||
"main": "is-generator.js",
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"test-spec": "mocha -R spec --bail",
|
||||
"test-cov": "node --harmony node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail",
|
||||
"test": "npm run lint && npm run test-cov"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/blakeembrey/is-generator.git"
|
||||
},
|
||||
"keywords": [
|
||||
"generator",
|
||||
"generator function",
|
||||
"yield",
|
||||
"function",
|
||||
"await",
|
||||
"es6",
|
||||
"function*"
|
||||
],
|
||||
"author": {
|
||||
"name": "Blake Embrey",
|
||||
"email": "hello@blakeembrey.com",
|
||||
"url": "http://blakeembrey.me"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/blakeembrey/is-generator/issues"
|
||||
},
|
||||
"homepage": "https://github.com/blakeembrey/is-generator",
|
||||
"devDependencies": {
|
||||
"istanbul": "git://github.com/gotwarlost/istanbul#harmony",
|
||||
"mocha": "^1.21.4",
|
||||
"pre-commit": "^1.0.7",
|
||||
"standard": "^3.11.1"
|
||||
}
|
||||
}
|
38
node_modules/is-generator/test.js
generated
vendored
Normal file
38
node_modules/is-generator/test.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var isGenerator = require('./')
|
||||
|
||||
describe('is-generator', function () {
|
||||
describe('generators', function () {
|
||||
it('should return false with non-generators', function () {
|
||||
assert(!isGenerator(null))
|
||||
assert(!isGenerator(25))
|
||||
assert(!isGenerator('test'))
|
||||
assert(!isGenerator(/* istanbul ignore next */ function () {}))
|
||||
assert(!isGenerator(/* istanbul ignore next */ function * () {}))
|
||||
})
|
||||
|
||||
it('should return true with a generator', function () {
|
||||
assert(isGenerator((/* istanbul ignore next */ function * () {})()))
|
||||
})
|
||||
})
|
||||
|
||||
describe('generator functions', function () {
|
||||
it('should return false with non-generator function', function () {
|
||||
assert(!isGenerator.fn(null))
|
||||
assert(!isGenerator.fn(25))
|
||||
assert(!isGenerator.fn('test'))
|
||||
assert(!isGenerator.fn(/* istanbul ignore next */ function () {}))
|
||||
|
||||
var noConstructorFn = /* istanbul ignore next */ function () {}
|
||||
noConstructorFn.constructor = undefined
|
||||
|
||||
assert(!isGenerator.fn(noConstructorFn))
|
||||
})
|
||||
|
||||
it('should return true with a generator function', function () {
|
||||
assert(isGenerator.fn(/* istanbul ignore next */ function * () { yield 'something' }))
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user