pax_global_header00006660000000000000000000000064126221312370014511gustar00rootroot0000000000000052 comment=0ba5937996916914a50e519e9dff2a0cf58c5974 is-generator-fn-1.0.0/000077500000000000000000000000001262213123700145075ustar00rootroot00000000000000is-generator-fn-1.0.0/.editorconfig000066400000000000000000000003471262213123700171700ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false is-generator-fn-1.0.0/.gitattributes000066400000000000000000000000141262213123700173750ustar00rootroot00000000000000* text=auto is-generator-fn-1.0.0/.gitignore000066400000000000000000000000151262213123700164730ustar00rootroot00000000000000node_modules is-generator-fn-1.0.0/.travis.yml000066400000000000000000000000761262213123700166230ustar00rootroot00000000000000language: node_js node_js: - 'stable' - '0.12' - '0.10' is-generator-fn-1.0.0/index.js000066400000000000000000000004231262213123700161530ustar00rootroot00000000000000'use strict'; var toString = Object.prototype.toString; module.exports = function (fn) { if (typeof fn !== 'function') { return false; } return (fn.constructor && fn.constructor.name === 'GeneratorFunction') || toString.call(fn) === '[object GeneratorFunction]'; }; is-generator-fn-1.0.0/license000066400000000000000000000021371262213123700160570ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.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. is-generator-fn-1.0.0/package.json000066400000000000000000000011501262213123700167720ustar00rootroot00000000000000{ "name": "is-generator-fn", "version": "1.0.0", "description": "Check if something is a generator function", "license": "MIT", "repository": "sindresorhus/is-generator-fn", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "generator", "gen", "function", "func", "fn", "is", "check", "detect", "yield" ], "devDependencies": { "ava": "*", "xo": "*" } } is-generator-fn-1.0.0/readme.md000066400000000000000000000010761262213123700162720ustar00rootroot00000000000000# is-generator-fn [![Build Status](https://travis-ci.org/sindresorhus/is-generator-fn.svg?branch=master)](https://travis-ci.org/sindresorhus/is-generator-fn) > Check if something is a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) ## Install ``` $ npm install --save is-generator-fn ``` ## Usage ```js const isGeneratorFn = require('is-generator-fn'); isGeneratorFn(function * () {}); //=> true isGeneratorFn(function () {}); //=> false ``` ## License MIT © [Sindre Sorhus](http://sindresorhus.com) is-generator-fn-1.0.0/test.js000066400000000000000000000003731262213123700160270ustar00rootroot00000000000000import test from 'ava'; import fn from './'; test(t => { t.true(fn(function * () {})); t.true(fn(function * () { yield 'unicorn'; })); t.false(fn(null)); t.false(fn(undefined)); t.false(fn(function () {})); t.false(fn('')); t.end(); });