
Research
/Security News
jscrambler npm Package Compromised in Supply Chain Attack
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.
@wujue0115/fetch-factory
Advanced tools
The fetch-factory is a JavaScript library for simplified HTTP requests. It provides a convenient way to create and send HTTP requests with a customizable configuration.
Install fetch-factory using a package manager such as npm, yarn, or pnpm.
npm install @wujue0115/fetch-factory
yarn add @wujue0115/fetch-factory
pnpm install @wujue0115/fetch-factory
Create an instance of FetchFactory by providing a base URL and default configuration:
import FetchFactory from "@wujue0115/fetch-factory";
const myAPI = new FetchFactory({
baseUrl: "http://...",
baseConfig: {
headers: {
...
}
}
});
Use the fetch method for making HTTP requests, such as a GET request:
async function fetch() {
const { data, error } = await myAPI.fetch("/example...", "get");
data && console.log(data);
error && console.error(error);
}
Similarly, you can use the get method to send an HTTP GET request.
async function getRequest() {
const { data, error } = await myAPI.get("/example...");
data && console.log(data);
error && console.error(error);
}
The fetch method in FetchFactory supports multiple configurations, providing flexibility for various use cases. Each argument enables you to customize the URL, HTTP method, request data, headers, and additional options. Here are the different configurations:
myAPI.fetch(/* options */);
myAPI.fetch(/* url */, /* options */);
myAPI.fetch(/* url */, /* method */, /* options */);
myAPI.fetch(/* url */, /* method */, /* data */, /* options */);
myAPI.fetch(/* url */, /* method */, /* data */, /* headers */, /* options */);
For get, post, put, and delete methods, the example below presents the support for multiple parameters.
myAPI.get(/* options */);
myAPI.get(/* url */, /* options */);
myAPI.get(/* url */, /* params */, /* options */);
myAPI.get(/* url */, /* params */, /* headers */, /* options */);
myAPI.post(/* options */);
myAPI.post(/* url */, /* options */);
myAPI.post(/* url */, /* data */, /* options */);
myAPI.post(/* url */, /* data */, /* headers */, /* options */);
The options argument is equivalent to the axios request config.
FAQs
A fetch wrapper for browser and nodejs.
We found that @wujue0115/fetch-factory 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.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.

Research
/Security News
A malicious .NET package is typosquatting the Braintree SDK to steal live payment card data, merchant API keys, and host secrets from production apps.

Security News
/Research
Compromised Injective SDK npm version 1.20.21 exfiltrates wallet private keys and mnemonics through fake telemetry functionality.