pax_global_header 0000666 0000000 0000000 00000000064 14744360606 0014524 g ustar 00root root 0000000 0000000 52 comment=287a194ca6f5d484ae3c29819c4b0ec876fe0eca
inspect-js-is-async-function-4652bef/ 0000775 0000000 0000000 00000000000 14744360606 0017571 5 ustar 00root root 0000000 0000000 inspect-js-is-async-function-4652bef/.eslintrc 0000664 0000000 0000000 00000000120 14744360606 0021406 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
"rules": {
"no-new-func": 1,
},
}
inspect-js-is-async-function-4652bef/.github/ 0000775 0000000 0000000 00000000000 14744360606 0021131 5 ustar 00root root 0000000 0000000 inspect-js-is-async-function-4652bef/.github/workflows/ 0000775 0000000 0000000 00000000000 14744360606 0023166 5 ustar 00root root 0000000 0000000 inspect-js-is-async-function-4652bef/.github/workflows/node-aught.yml 0000664 0000000 0000000 00000000533 14744360606 0025745 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js < 10'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '< 10'
type: minors
command: npm run tests-only
node:
name: 'node < 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
inspect-js-is-async-function-4652bef/.github/workflows/node-pretest.yml 0000664 0000000 0000000 00000000245 14744360606 0026323 0 ustar 00root root 0000000 0000000 name: 'Tests: pretest/posttest'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
inspect-js-is-async-function-4652bef/.github/workflows/node-tens.yml 0000664 0000000 0000000 00000000547 14744360606 0025613 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js 10 - 20'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 10 < 20'
type: minors
command: npm run tests-only
node:
name: 'node 10 - 20'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
inspect-js-is-async-function-4652bef/.github/workflows/node-twenties.yml 0000664 0000000 0000000 00000000536 14744360606 0026502 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js >= 20'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 20'
type: minors
command: npm run tests-only
node:
name: 'node >= 20'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
inspect-js-is-async-function-4652bef/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000257 14744360606 0025156 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request_target]
jobs:
_:
uses: ljharb/actions/.github/workflows/rebase.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
inspect-js-is-async-function-4652bef/.github/workflows/require-allow-edits.yml 0000664 0000000 0000000 00000000515 14744360606 0027610 0 ustar 00root root 0000000 0000000 name: Require “Allow Edits”
on: [pull_request_target]
permissions:
contents: read
jobs:
_:
permissions:
pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR
name: "Require “Allow Edits”"
runs-on: ubuntu-latest
steps:
- uses: ljharb/require-allow-edits@main
inspect-js-is-async-function-4652bef/.gitignore 0000664 0000000 0000000 00000003251 14744360606 0021562 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
.npmignore
inspect-js-is-async-function-4652bef/.npmrc 0000664 0000000 0000000 00000000067 14744360606 0020714 0 ustar 00root root 0000000 0000000 package-lock=false
allow-same-version=true
message=v%s
inspect-js-is-async-function-4652bef/.nycrc 0000664 0000000 0000000 00000000213 14744360606 0020704 0 ustar 00root root 0000000 0000000 {
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
inspect-js-is-async-function-4652bef/CHANGELOG.md 0000664 0000000 0000000 00000031355 14744360606 0021411 0 ustar 00root root 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.1](https://github.com/inspect-js/is-async-function/compare/v2.1.0...v2.1.1) - 2025-01-22
### Fixed
- [Refactor] use `async-function` for the eval parts [`#31`](https://github.com/inspect-js/is-async-function/issues/31)
### Commits
- [Refactor] move `new Function` helper into a separate file [`db36da5`](https://github.com/inspect-js/is-async-function/commit/db36da5467fbbf0f2ae264114be6aa9edf55e218)
- [Dev Deps] update `@arethetypeswrong/cli`, `@types/tape` [`981ab90`](https://github.com/inspect-js/is-async-function/commit/981ab907b700d344b510ca1617fda00a66513aa2)
- [meta] add `exports` [`81bb8e5`](https://github.com/inspect-js/is-async-function/commit/81bb8e578c8cbeeda742715ab7a935c0472866a1)
- [Refactor] skip `getProto` call when `AsyncFunction` does not exist [`dc929a5`](https://github.com/inspect-js/is-async-function/commit/dc929a547a5f7cd1337b176d20135b8cc3cc23cb)
## [v2.1.0](https://github.com/inspect-js/is-async-function/compare/v2.0.0...v2.1.0) - 2025-01-02
### Commits
- [meta] use `npmignore` to autogenerate an npmignore file [`b8d050b`](https://github.com/inspect-js/is-async-function/commit/b8d050ba1ab615ef748e8ffbe48c5fc4e14af510)
- [actions] split out node 10-20, and 20+ [`1c8cd4b`](https://github.com/inspect-js/is-async-function/commit/1c8cd4bb565934ec5a4d9fc351ac9c8e2b217c07)
- [New] add types [`5ba6244`](https://github.com/inspect-js/is-async-function/commit/5ba62441efb4eb267659bcccd615018e7e09cc30)
- [Robustness] use `call-bound`, `safe-regex-test` [`9379ecd`](https://github.com/inspect-js/is-async-function/commit/9379ecda6ddce8460a6a0dc1a3d5555443b0b510)
- [actions] update rebase action to use reusable workflow [`81b54fb`](https://github.com/inspect-js/is-async-function/commit/81b54fbcb881ac0000306dfd8aade39c51191256)
- [Tests] use `for-each` [`ebdc486`](https://github.com/inspect-js/is-async-function/commit/ebdc486ab08c35651567c9f21f11a18ab5618737)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `npmignore`, `tape` [`9eb494f`](https://github.com/inspect-js/is-async-function/commit/9eb494f5f5a89eebf7981db906c0c821598465fe)
- [Dev Deps] update `aud`, `tape` [`ea43809`](https://github.com/inspect-js/is-async-function/commit/ea43809bff25e47e196bde254c7383464c03ae7e)
- [Refactor] use `get-proto` directly [`fc46390`](https://github.com/inspect-js/is-async-function/commit/fc4639088bb6ed4e8b19988d3e642d45ee45e70e)
- [Tests] replace `aud` with `npm audit` [`edb4afb`](https://github.com/inspect-js/is-async-function/commit/edb4afb68d6d63d049608269fdf83cdb98956ff3)
- [Deps] update `has-tostringtag` [`dc78cf5`](https://github.com/inspect-js/is-async-function/commit/dc78cf545f87ecc17fc7f3426bbbc5ecdea9d167)
- [Dev Deps] add missing peer dep [`a93d8ff`](https://github.com/inspect-js/is-async-function/commit/a93d8ff0a22e4351d625ca5bb0fc73d222f9756c)
## [v2.0.0](https://github.com/inspect-js/is-async-function/compare/v1.3.0...v2.0.0) - 2022-04-11
### Commits
- [Breaking] v2 implementation and tests [`d79a37e`](https://github.com/inspect-js/is-async-function/commit/d79a37e25e24a74be3c349de51fda4ad58f30f3a)
- Initial commit [`456defc`](https://github.com/inspect-js/is-async-function/commit/456defc6dc36809d11dd5a199110e46fe9fb4a6f)
- npm init [`d35b611`](https://github.com/inspect-js/is-async-function/commit/d35b611d669e57a3a6fd017930d3bf9a0589ffd2)
- Only apps should have lockfiles [`5920874`](https://github.com/inspect-js/is-async-function/commit/5920874ec2b26762d1037168a73e1c29a4286b1a)
## [v1.3.0](https://github.com/inspect-js/is-async-function/compare/v1.2.4...v1.3.0) - 2020-01-15
### Commits
- feat: update deps, ci, readme [`dbb52a7`](https://github.com/inspect-js/is-async-function/commit/dbb52a7714887e897df62302a6ad8e8402d67fe4)
- chore(release): 1.3.0 [`972e26c`](https://github.com/inspect-js/is-async-function/commit/972e26c01ad14aa3560462624f24f4464efc46a3)
## [v1.2.4](https://github.com/inspect-js/is-async-function/compare/v1.2.3...v1.2.4) - 2020-01-15
### Merged
- fix(src): remove unneeded condition [`#16`](https://github.com/inspect-js/is-async-function/pull/16)
### Fixed
- fix: update deps + the tests; close #17 [`#17`](https://github.com/inspect-js/is-async-function/issues/17)
### Commits
- chore: update broken badge links [`2985e36`](https://github.com/inspect-js/is-async-function/commit/2985e36a644306ab2beb392e6833860cc1b3dadf)
- chore: add github funding file [`377233a`](https://github.com/inspect-js/is-async-function/commit/377233ab85f042e68b4cf5c7fd91860b77e8ce53)
- chore: all modules are stable for years [`b7db9f0`](https://github.com/inspect-js/is-async-function/commit/b7db9f07cfcd8e3f7f7c448f71dcf73ef0e9b67e)
- chore(release): 1.2.4 [`a9f441f`](https://github.com/inspect-js/is-async-function/commit/a9f441f0b801dabf6e8a1690c871fd564e56ddad)
- fix: add npm funding field [`c05ef28`](https://github.com/inspect-js/is-async-function/commit/c05ef28a1aa33543fc29c1c897613dc8676c1afc)
- chore: drop testing on old Node versions [`c975f68`](https://github.com/inspect-js/is-async-function/commit/c975f68a788d99ebf109a34ed9867f19c85b8805)
- chore(ci): test on 6 only [`106dcdd`](https://github.com/inspect-js/is-async-function/commit/106dcdd6d225248ef55c41218706fef1a7ce8c0e)
## [v1.2.3](https://github.com/inspect-js/is-async-function/compare/v1.2.2...v1.2.3) - 2017-03-11
### Commits
- fix(style): remove lazy-cache, and update boilerplate stuff [`abd32db`](https://github.com/inspect-js/is-async-function/commit/abd32dba0d727e9a75fffa7ef7df138bbc722b69)
- fix(docs): regenerate readme [`592f1b7`](https://github.com/inspect-js/is-async-function/commit/592f1b721c7c81bc1a6a84e462f4bd7ba7f24cd3)
- fix(package): add missing dependency [`73f404d`](https://github.com/inspect-js/is-async-function/commit/73f404d9afc054c90c1f1bee280497ac809b1eb3)
- chore(release): 1.2.3 [`103cf28`](https://github.com/inspect-js/is-async-function/commit/103cf28cfa5302a5a00bb5c9bd8bf9ecc69999fa)
- fix(package): wrong version, because too fast update ;d [`2e887f0`](https://github.com/inspect-js/is-async-function/commit/2e887f09dbc9e234f5f26cadd4e7fe9cc97184fb)
## [v1.2.2](https://github.com/inspect-js/is-async-function/compare/v1.2.1...v1.2.2) - 2016-10-29
### Fixed
- fix(docs): fixes and updates API docs [`#14`](https://github.com/inspect-js/is-async-function/issues/14)
### Commits
- chore(release): 1.2.2 [`9165f94`](https://github.com/inspect-js/is-async-function/commit/9165f942865906a02e0f9afe55ac2f305d71a9b1)
## [v1.2.1](https://github.com/inspect-js/is-async-function/compare/v1.2.0...v1.2.1) - 2016-10-27
### Fixed
- fix(non-strict): fix a bug in non-strict mode [`#13`](https://github.com/inspect-js/is-async-function/issues/13)
### Commits
- chore(release): 1.2.1 [`f4c7f02`](https://github.com/inspect-js/is-async-function/commit/f4c7f02ecb1ca02772890552797da3b39883ed43)
## [v1.2.0](https://github.com/inspect-js/is-async-function/compare/v1.1.5...v1.2.0) - 2016-10-27
### Merged
- Revert "Update arr-includes to version 2.0.0 🚀" [`#12`](https://github.com/inspect-js/is-async-function/pull/12)
- chore(package): update arr-includes to version 2.0.0 [`#11`](https://github.com/inspect-js/is-async-function/pull/11)
### Commits
- feat(strict): introduce strict mode [`ef8526f`](https://github.com/inspect-js/is-async-function/commit/ef8526ffa8ba2b4cf37f6bd2dae21aee871e6e6a)
- docs(update): api docs [`739eb54`](https://github.com/inspect-js/is-async-function/commit/739eb5482ba560ad2de153a29fc16778f4d3ef3f)
- chore(release): 1.2.0 [`3222afe`](https://github.com/inspect-js/is-async-function/commit/3222afed47c9b5d2fa12490aff2d7c9887183ea2)
## [v1.1.5](https://github.com/inspect-js/is-async-function/compare/v1.1.4...v1.1.5) - 2016-09-21
### Commits
- chore(tests): simplify tests [`be112bb`](https://github.com/inspect-js/is-async-function/commit/be112bb3dec204f174bf745056b7c0fc7377aef5)
- Release v1.1.5 [`577d96c`](https://github.com/inspect-js/is-async-function/commit/577d96c9f0fb6288e6bc88d8e51703b98f19b20c)
## [v1.1.4](https://github.com/inspect-js/is-async-function/compare/v1.1.3...v1.1.4) - 2016-09-21
### Fixed
- chore(package): update deps, use lazy-cache - closes #10 [`#10`](https://github.com/inspect-js/is-async-function/issues/10)
### Commits
- chore(package/tests): update to use `mukla` instead of `assertit` lib [`83011b1`](https://github.com/inspect-js/is-async-function/commit/83011b1e2820e239c606d872468582f5a9249c47)
- chore(package): update npm scripts, add coveralls/standard/nyc to devDeps [`631acbd`](https://github.com/inspect-js/is-async-function/commit/631acbdcf9fd9aa6d56ac98e10f3092e7e5be485)
- chore(gitignore): update gitignore [`7f09f8f`](https://github.com/inspect-js/is-async-function/commit/7f09f8f40777879e70315dfeef0805755a44a293)
- chore(editorconfig): update editorconfig [`8bb8593`](https://github.com/inspect-js/is-async-function/commit/8bb85939f87e6738c5ca35b5e5f5d8cca67353c9)
- docs(readme): run verb to update readme [`cf15044`](https://github.com/inspect-js/is-async-function/commit/cf150446dc4e948f2629377d7f369824bfda8b3b)
- Release v1.1.4 [`41190e1`](https://github.com/inspect-js/is-async-function/commit/41190e1da3aeb787921b3ea5d834634295c31de8)
## [v1.1.3](https://github.com/inspect-js/is-async-function/compare/v1.1.2...v1.1.3) - 2016-04-21
### Merged
- chore(package): update is-match to version 0.4.1 [`#7`](https://github.com/inspect-js/is-async-function/pull/7)
### Commits
- use `common-callback-names` [`37c253f`](https://github.com/inspect-js/is-async-function/commit/37c253f9a34b68acd5651075a3f1b74cd30ed8fd)
- Release v1.1.3 [`f212193`](https://github.com/inspect-js/is-async-function/commit/f212193a00790ccae387e2d7a373076fcbbb9d8f)
## [v1.1.2](https://github.com/inspect-js/is-async-function/compare/v1.1.1...v1.1.2) - 2016-03-18
### Commits
- cleanup and update metadata [`e09ab8b`](https://github.com/inspect-js/is-async-function/commit/e09ab8b98e6aecd28d38ba4ff4c1f17c26549a06)
- update docs [`42920c6`](https://github.com/inspect-js/is-async-function/commit/42920c699f706fcf1048e0c039b335d7bbaf34ed)
- Release v1.1.2 [`19d77d6`](https://github.com/inspect-js/is-async-function/commit/19d77d6ba7abe87ecf4d2765cd8536fca140b3bd)
## [v1.1.1](https://github.com/inspect-js/is-async-function/compare/v1.1.0...v1.1.1) - 2016-03-18
### Commits
- run update [`27b21bf`](https://github.com/inspect-js/is-async-function/commit/27b21bf76254635d6c5c18f896b6f151938ae810)
- add docs [`ab38f94`](https://github.com/inspect-js/is-async-function/commit/ab38f947707182e0ea165e3bee90bd46b8dbfaf9)
- update docs [`90654c9`](https://github.com/inspect-js/is-async-function/commit/90654c93e8ff9d0cfd1443ae3609cd898b57ef11)
- refactor, allow passing custom array of argument names [`a1787c7`](https://github.com/inspect-js/is-async-function/commit/a1787c757f522cb5e1c568ec5270be14a38c4cc9)
- add related libs [`868f423`](https://github.com/inspect-js/is-async-function/commit/868f4235a449d610a87351e5a5070f42a0c6e7ce)
- Release v1.1.1 [`bc7d85e`](https://github.com/inspect-js/is-async-function/commit/bc7d85e2a115163d3b09f78be5196f21adce1a7c)
- update description [`ce2e97b`](https://github.com/inspect-js/is-async-function/commit/ce2e97b34762f2087699a5b9910e498ec7062090)
## [v1.1.0](https://github.com/inspect-js/is-async-function/compare/v1.0.0...v1.1.0) - 2015-06-25
### Commits
- Release v1.1.0 [`b3f3704`](https://github.com/inspect-js/is-async-function/commit/b3f3704f13a32664a08b3d55162925e37626f5e8)
- update metadata [`95e6bc2`](https://github.com/inspect-js/is-async-function/commit/95e6bc2cc195ff5d2ab01f47c6a157b3a583d01a)
- check also for `done` and `next` [`6697d29`](https://github.com/inspect-js/is-async-function/commit/6697d29430ac9ce5f55572a2d7762baa1f05a33b)
## v1.0.0 - 2015-06-05
### Commits
- :cat2: implement :star2: [`eaccc68`](https://github.com/inspect-js/is-async-function/commit/eaccc681838a983390e93607451500982759bd7a)
- add keywords [`55a5ffc`](https://github.com/inspect-js/is-async-function/commit/55a5ffc65d344328cf5b5bb7b7e1520ecede0035)
- Release v1.0.0 [`66eab5f`](https://github.com/inspect-js/is-async-function/commit/66eab5f96c62a6a39b913a84e8ec4b37c657026a)
- refactor [`a7ce00d`](https://github.com/inspect-js/is-async-function/commit/a7ce00d537bf420338b91fee00eb6893d14952bf)
- add test for when throw [`60d0175`](https://github.com/inspect-js/is-async-function/commit/60d0175a955645b304f572fd571a1ced47486958)
- add `related` section [`904acd8`](https://github.com/inspect-js/is-async-function/commit/904acd8fbd5c6c020ba537cc9962154d818ad067)
- simplify travis [`ee17273`](https://github.com/inspect-js/is-async-function/commit/ee172737486a8a5f7b2b642aa72e6ca7a1749a1c)
- Initial commit [`7e914c1`](https://github.com/inspect-js/is-async-function/commit/7e914c1c6d669635f239fa86d9d96f85d8aaaab4)
inspect-js-is-async-function-4652bef/LICENSE 0000664 0000000 0000000 00000002071 14744360606 0020576 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2021 Jordan Harband
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.
inspect-js-is-async-function-4652bef/README.md 0000664 0000000 0000000 00000003323 14744360606 0021051 0 ustar 00root root 0000000 0000000 # is-async-function [![Version Badge][2]][1]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
Is this a native `async function`?
## Example
```js
var isAsyncFunction = require('is-async-function');
assert(!isAsyncFunction(function () {}));
assert(!isAsyncFunction(null));
assert(!isAsyncFunction(function* () { yield 42; return Infinity; }));
assert(isAsyncFunction(async function () {}));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-async-function
[2]: https://versionbadg.es/inspect-js/is-async-function.svg
[5]: https://david-dm.org/inspect-js/is-async-function.svg
[6]: https://david-dm.org/inspect-js/is-async-function
[7]: https://david-dm.org/inspect-js/is-async-function/dev-status.svg
[8]: https://david-dm.org/inspect-js/is-async-function#info=devDependencies
[11]: https://nodei.co/npm/is-async-function.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-async-function.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-async-function.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-async-function
[codecov-image]: https://codecov.io/gh/inspect-js/is-async-function/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-async-function/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-async-function
[actions-url]: https://github.com/inspect-js/is-async-function/actions
inspect-js-is-async-function-4652bef/index.d.ts 0000664 0000000 0000000 00000000336 14744360606 0021474 0 ustar 00root root 0000000 0000000 import type { AsyncFunction } from 'async-function';
declare namespace isAsyncFunction {
export type { AsyncFunction };
}
declare function isAsyncFunction(fn: unknown): fn is AsyncFunction;
export = isAsyncFunction; inspect-js-is-async-function-4652bef/index.js 0000664 0000000 0000000 00000001476 14744360606 0021246 0 ustar 00root root 0000000 0000000 'use strict';
var callBound = require('call-bound');
var safeRegexTest = require('safe-regex-test');
var toStr = callBound('Object.prototype.toString');
var fnToStr = callBound('Function.prototype.toString');
var isFnRegex = safeRegexTest(/^\s*async(?:\s+function(?:\s+|\()|\s*\()/);
var hasToStringTag = require('has-tostringtag/shams')();
var getProto = require('get-proto');
var getAsyncFunc = require('async-function');
/** @type {import('.')} */
module.exports = function isAsyncFunction(fn) {
if (typeof fn !== 'function') {
return false;
}
if (isFnRegex(fnToStr(fn))) {
return true;
}
if (!hasToStringTag) {
var str = toStr(fn);
return str === '[object AsyncFunction]';
}
if (!getProto) {
return false;
}
var asyncFunc = getAsyncFunc();
return asyncFunc && asyncFunc.prototype === getProto(fn);
};
inspect-js-is-async-function-4652bef/package.json 0000664 0000000 0000000 00000005457 14744360606 0022072 0 ustar 00root root 0000000 0000000 {
"name": "is-async-function",
"version": "2.1.1",
"description": "Determine if a function is a native async function.",
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "nyc npm run test:all",
"test:all": "npm run test:index && npm run test:uglified",
"test:index": "node test",
"test:uglified": "node test/uglified",
"posttest": "npx npm@\">= 10.2\" audit --production",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc && attw -P",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git://github.com/inspect-js/is-async-function.git"
},
"keywords": [
"async",
"async function",
"es6",
"es2015",
"yield",
"function",
"function*"
],
"author": "Jordan Harband ",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/is-async-function/issues"
},
"dependencies": {
"async-function": "^1.0.0",
"call-bound": "^1.0.3",
"get-proto": "^1.0.1",
"has-tostringtag": "^1.0.2",
"safe-regex-test": "^1.1.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.3",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.3",
"@types/for-each": "^0.3.3",
"@types/make-async-function": "^1.0.2",
"@types/make-generator-function": "^2.0.3",
"@types/tape": "^5.8.1",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"for-each": "^0.3.3",
"in-publish": "^2.0.1",
"make-async-function": "^1.0.0",
"make-generator-function": "^2.0.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next",
"uglify-register": "^1.0.1"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}
inspect-js-is-async-function-4652bef/test/ 0000775 0000000 0000000 00000000000 14744360606 0020550 5 ustar 00root root 0000000 0000000 inspect-js-is-async-function-4652bef/test/index.js 0000664 0000000 0000000 00000005656 14744360606 0022231 0 ustar 00root root 0000000 0000000 'use strict';
/* globals window */
var test = require('tape');
var isAsyncFunction = require('../index');
var generatorFuncs = require('make-generator-function')();
var asyncFuncs = require('make-async-function').list();
var hasToStringTag = require('has-tostringtag/shams')();
var forEach = require('for-each');
test('returns false for non-functions', function (t) {
var nonFuncs = [
true,
false,
null,
undefined,
{},
[],
/a/g,
'string',
42,
new Date()
];
t.plan(nonFuncs.length);
forEach(nonFuncs, function (nonFunc) {
t.notOk(isAsyncFunction(nonFunc), nonFunc + ' is not a function');
});
t.end();
});
test('returns false for non-async functions', function (t) {
var func = function () {};
t.notOk(isAsyncFunction(func), 'anonymous function is not an async function');
var namedFunc = function foo() {};
t.notOk(isAsyncFunction(namedFunc), 'named function is not an async function');
if (typeof window === 'undefined') {
t.skip('window.alert is not an async function');
} else {
t.notOk(isAsyncFunction(window.alert), 'window.alert is not an async function');
}
t.end();
});
var fakeToString = function () { return 'async function () { return "TOTALLY REAL I SWEAR!"; }'; };
test('returns false for non-async function with faked toString', function (t) {
var func = function () {};
func.toString = fakeToString;
t.notEqual(String(func), Function.prototype.toString.apply(func), 'faked toString is not real toString');
t.notOk(isAsyncFunction(func), 'anonymous function with faked toString is not an async function');
t.end();
});
test('returns false for generator functions', function (t) {
if (generatorFuncs.length > 0) {
forEach(generatorFuncs, function (generatorFunc) {
t.notOk(isAsyncFunction(generatorFunc), generatorFunc + ' is not async function');
});
} else {
t.skip('generator function is not async function - this environment does not support ES6 generator functions. Please use an engine that supports them.');
}
t.end();
});
test('returns false for non-async function with faked @@toStringTag', { skip: !hasToStringTag || asyncFuncs.length === 0 }, function (t) {
var asyncFunc = asyncFuncs[0];
/** @type {{ toString(): unknown; valueOf(): unknown; [Symbol.toStringTag]?: unknown }} */
var fakeAsyncFunction = {
toString: function () { return String(asyncFunc); },
valueOf: function () { return asyncFunc; }
};
fakeAsyncFunction[Symbol.toStringTag] = 'AsyncFunction';
t.notOk(isAsyncFunction(fakeAsyncFunction), 'fake AsyncFunction with @@toStringTag "AsyncFunction" is not an async function');
t.end();
});
test('returns true for async functions', function (t) {
if (asyncFuncs.length > 0) {
forEach(asyncFuncs, function (asyncFunc) {
t.ok(isAsyncFunction(asyncFunc), asyncFunc + ' is async function');
});
} else {
t.skip('async function is async function - this environment does not support ES2018 async functions. Please use an engine that supports them.');
}
t.end();
});
inspect-js-is-async-function-4652bef/test/uglified.js 0000664 0000000 0000000 00000000247 14744360606 0022701 0 ustar 00root root 0000000 0000000 'use strict';
// @ts-expect-error
require('uglify-register/api').register({
exclude: [/\/node_modules\//, /\/test\//],
uglify: { mangle: true }
});
require('./');
inspect-js-is-async-function-4652bef/tsconfig.json 0000664 0000000 0000000 00000000234 14744360606 0022277 0 ustar 00root root 0000000 0000000 {
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "ES2021",
"maxNodeModuleJsDepth": 0,
},
"exclude": [
"coverage",
],
}