Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
is-actual-promise
Advanced tools
Similar to p-is-promise
and
is-promise
, which are also both
fine alternatives to this.
Differences (ie, "why this thing then?")
is-promise
is hybrid, but p-is-promise
is ESM-only.Promise
interface, not just PromiseLike
(ie, it also
asserts .catch()
and .finally()
. (p-is-promise
tests for
.catch()
, neither tests for .finally()
.)Promise<any | void>
.(Note that this module does not verify that the .catch()
,
.then()
, and .finally()
methods return Promises, because that
is impossible at run-time without actually calling them. No
duck-typing method should ever be considered fully
authoritative.)
import { isPromise } from 'is-actual-promise'
console.log(isPromise(new Promise(() => {}))) // true
console.log(isPromise((async () => true)())) // true
console.log(isPromise(Promise.resolve(true))) // true
console.log(isPromise({
then: async () => 5,
finally: async () => {},
catch: () => {},
})) // true, but not accurate, limitation of duck typing
FAQs
Verify if something is a Promise
The npm package is-actual-promise receives a total of 66,467 weekly downloads. As such, is-actual-promise popularity was classified as popular.
We found that is-actual-promise demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.