Socket
Socket
Sign inDemoInstall

is-generator-fn

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 3.0.0

33

index.d.ts

@@ -1,24 +0,15 @@

declare const isGeneratorFn: {
/**
Check if something is a generator function.
/**
Check if something is a generator function.
@example
```
import isGeneratorFn = require('is-generator-fn');
@example
```
import isGeneratorFunction from 'is-generator-fn';
isGeneratorFn(function * () {});
//=> true
isGeneratorFunction(function * () {});
//=> true
isGeneratorFn(function () {});
//=> false
```
*/
(value: unknown): value is GeneratorFunction;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function isGeneratorFn(value: unknown): value is GeneratorFunction;
// export = isGeneratorFn;
default: typeof isGeneratorFn;
};
export = isGeneratorFn;
isGeneratorFunction(function () {});
//=> false
```
*/
export default function isGeneratorFunction(value: unknown): value is GeneratorFunction;

@@ -1,5 +0,4 @@

'use strict';
const {toString} = Object.prototype;
module.exports = value => {
export default function isGeneratorFunction(value) {
if (typeof value !== 'function') {

@@ -9,7 +8,4 @@ return false;

return (value.constructor && value.constructor.name === 'GeneratorFunction') ||
toString.call(value) === '[object GeneratorFunction]';
};
// TODO: Remove this for the next major release
module.exports.default = module.exports;
return (value.constructor && value.constructor.name === 'GeneratorFunction')
|| toString.call(value) === '[object GeneratorFunction]';
}
{
"name": "is-generator-fn",
"version": "2.1.0",
"version": "3.0.0",
"description": "Check if something is a generator function",
"license": "MIT",
"repository": "sindresorhus/is-generator-fn",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=6"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},

@@ -34,6 +37,6 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
}
}

@@ -1,6 +0,5 @@

# is-generator-fn [![Build Status](https://travis-ci.org/sindresorhus/is-generator-fn.svg?branch=master)](https://travis-ci.org/sindresorhus/is-generator-fn)
# is-generator-fn
> Check if something is a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*)
## Install

@@ -12,23 +11,16 @@

## Usage
```js
const isGeneratorFn = require('is-generator-fn');
import isGeneratorFunction from 'is-generator-fn';
isGeneratorFn(function * () {});
isGeneratorFunction(function * () {});
//=> true
isGeneratorFn(function () {});
isGeneratorFunction(function () {});
//=> false
```
## Related
- [is](https://github.com/sindresorhus/is) - Type check values
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc