Gathering detailed insights and metrics for @fiverr/gofor
Gathering detailed insights and metrics for @fiverr/gofor
Gathering detailed insights and metrics for @fiverr/gofor
Gathering detailed insights and metrics for @fiverr/gofor
🐕 factory interface for a lean fetch decorator that deep reverse merges default options
npm install @fiverr/gofor
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
34 Commits
2 Forks
66 Watchers
57 Branches
262 Contributors
Updated on Feb 10, 2021
Latest Version
1.2.0
Package Id
@fiverr/gofor@1.2.0
Unpacked Size
13.64 kB
Size
5.07 kB
File Count
10
NPM Version
5.10.0
Node Version
8.11.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Each Gofor instance exposes a fetch method: a lean, isomorphic fetch decorator that deep reverse merges default options.
Options you pass through in for each request will take precedence, but will supplemented with the defaults.
npm i gofor
Gofor
class1const Gofor = require('gofor'); 2const myGofor = new Gofor({headers: {'X-Custom-Header': 'Custom-Value'}}); 3 4myGofor.fetch('/page') 5 .then(...) 6 .catch(...);
You can opt to import the gofor
property to get a working instance with the default environment Headers
:
1const { gofor } = require('gofor'); 2 3gofor('/page').then(...); // This is the fetch
Each call to Gofor.gofor
generates a new instance:
1const gofor1 = require('gofor').gofor; 2const gofor2 = require('gofor').gofor; 3 4gofor1 === gofor2 // false
1const { gofor } = require('gofor'); 2const defaultHeaders = new Headers(); 3 4defaultHeaders.append('X-Requested-With', 'XMLHttpRequest'); 5defaultHeaders.append('Content-Type', 'application/json; charset=utf-8'); 6defaultHeaders.append('Accept', 'application/json'); 7 8gofor.config({ 9 credentials: 'same-origin', 10 headers: defaultHeaders 11}); 12 13// Use only defaults 14gofor('https://www.website.com').then(...); 15 16// Add/Apply other options 17gofor('/page', { 18 headers: { 19 'X-Custom-Header': 'Custom-Value' 20 } 21}).then(...);
Headers
Gofor
supports setting headers either as an object literal or as a Headers
instance
Default header keys will be run over if matched by passed in header keys. Other keys will be merged. This is made by design.
1// Configure using the "Headers" constructor 2 3gofor.config({ 4 credentials: 'same-origin', 5 headers: new Headers({ 6 'Content-Type': 'application/json; charset=utf-8', 7 'X-Custom-Header': 'Custom-Value' 8 }) 9}); 10 11// Or, using an object literal 12 13gofor.config({ 14 credentials: 'same-origin', 15 headers: { 16 'Content-Type': 'application/json; charset=utf-8', 17 'X-Custom-Header': 'Custom-Value' 18 } 19}); 20 21gofor('/page', { 22 headers: new Headers({ 23 'Content-Type': 'text/plain', 24 }) 25});
Final headers will be:
1 'Content-Type': 'text/plain', 2 'X-Custom-Header': 'Custom-Value'
The function will be called once on first use, and its result will be memoised. useful for cases where you need to pull information from the document and don't want to create a race condition.
1const { gofor } = require('gofor'); 2 3gofor.config(() => ({ 4 credentials: 'same-origin', 5 headers: { 6 'X-Requested-With': 'XMLHttpRequest', 7 'Content-Type': 'application/json; charset=utf-8', 8 'Accept': 'application/json', 9 'X-Custom-Secret': document.getElementById('secret').value, 10 }, 11}));
The two breaking changes in version 3 are:
gofor/server
) in favor of a truly isomorphic solution.dist
folder.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
branch protection is not maximal on development and all release branches
Details
Reason
Found 11/27 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More