
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
is-cloud-function
Advanced tools
A package who returns if your code is running on a cloud function (AWS, Google, Azure)
This is a package who returns a boolean if your code is running on a cloud function (AWS, Google, Azure) made by Sébastien Abbal. It's working with node.js language and Typescript.
$ npm install is-cloud-function
// or
$ yarn add is-cloud-function
import { isCloudFunction } from 'is-cloud-function';
console.log(isCloudFunction());
Provider | Enabled | Type |
---|---|---|
AWS Lambdas | ✅ | AWS |
Google cloud functions | ✅ | |
Azure functions | ✅ | AZURE |
IBM Cloud Functions | ❌ | - |
Cloudflare workers | ❌ | - |
Apex | ❌ | - |
You can manage a specific configuration to the isCloudFunction
:
PROVIDER
| BOOLEAN
(default: BOOLEAN
)import { isCloudFunction } from 'is-cloud-function';
if (isCloudFunction() === true) {
// ... your logic ...
}
// Same like example above
if (isCloudFunction({ type: 'BOOLEAN' }) === true) {
// ... your logic ...
}
import { isCloudFunction } from 'is-cloud-function';
if (isCloudFunction({ type: 'PROVIDER' }) === 'AWS') {
// ... your logic ...
}
⚠️ Set the values from the enums represents a better practice than the "magic variables".
import { isCloudFunction, ICF_EnumConfigType } from 'is-cloud-function';
if (
isCloudFunction({ type: ICF_EnumConfigType.PROVIDER }) ===
ICF_EnumProviderType.AZURE
) {
// ... your logic ...
}
To test all the app with jest (100% coverage), you need to run this command line:
$ yarn test
This package is MIT licensed.
FAQs
A package who returns if your code is running on a cloud function (AWS, Google, Azure)
The npm package is-cloud-function receives a total of 0 weekly downloads. As such, is-cloud-function popularity was classified as not popular.
We found that is-cloud-function demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.