New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gmxhr-fetch

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gmxhr-fetch - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

13

gmxhr-fetch.js

@@ -10,10 +10,7 @@ ;((global, fn) => {

}
const fromEntries = e => e.reduce((acc, [k, v]) => ((acc[k] = v), acc), {})
const parseHeader = h =>
fromEntries(
h
.split('\n')
.filter(Boolean)
.map(l => l.split(':').map(tok => tok.trim()))
)
const splitHeaderLine = l => {
const i = l.indexOf(':')
return [l.slice(0, i), l.slice(i + 1).trimLeft()]
}
const parseHeader = h => Object.fromEntries(h.split('\r\n').filter(Boolean).map(splitHeaderLine))
const fetch = (input, init = {}) => {

@@ -20,0 +17,0 @@ if (input instanceof Request) {

@@ -1,1 +0,1 @@

((a,b)=>{a.gmfetch=b("undefined"==typeof GM?{}:GM)})(this,a=>{if("undefined"==typeof GM_xmlhttpRequest&&"undefined"==typeof a.xmlHttpRequest)throw new Error("Either GM_xmlhttpRequest or GM.xmlHttpRequest must exists!");"function"!=typeof GM_xmlhttpRequest||a.xmlHttpRequest||(a.xmlHttpRequest=GM_xmlhttpRequest);const b=a=>a.reduce((a,[b,c])=>(a[b]=c,a),{}),c=a=>b(a.split("\n").filter(Boolean).map(a=>a.split(":").map(a=>a.trim()))),d=(e,f={})=>e instanceof Request?d(e.url,Object.assign({},e,f)):new Promise(d=>{f.headers instanceof Headers&&(f.headers=b(Array.from(f.headers.entries()))),f.data=f.body,f=Object.assign({method:"GET",headers:{}},f,{url:e,responseType:"blob"}),a.xmlHttpRequest(Object.assign({},f,{onload:a=>{a.headers=c(a.responseHeaders),d(new Response(a.response,Object.assign({},f,a)))},onerror:a=>{console.log("err",a),d(new Response(a.response,Object.assign({},f,a)))}}))});return d});
((a,b)=>{a.gmfetch=b("undefined"==typeof GM?{}:GM)})(this,a=>{if("undefined"==typeof GM_xmlhttpRequest&&"undefined"==typeof a.xmlHttpRequest)throw new Error("Either GM_xmlhttpRequest or GM.xmlHttpRequest must exists!");"function"!=typeof GM_xmlhttpRequest||a.xmlHttpRequest||(a.xmlHttpRequest=GM_xmlhttpRequest);const b=a=>{const b=a.indexOf(":");return[a.slice(0,b),a.slice(b+1).trimLeft()]},c=a=>Object.fromEntries(a.split("\r\n").filter(Boolean).map(b)),d=(b,e={})=>b instanceof Request?d(b.url,Object.assign({},b,e)):new Promise(d=>{e.headers instanceof Headers&&(e.headers=fromEntries(Array.from(e.headers.entries()))),e.data=e.body,e=Object.assign({method:"GET",headers:{}},e,{url:b,responseType:"blob"}),a.xmlHttpRequest(Object.assign({},e,{onload:a=>{a.headers=c(a.responseHeaders),d(new Response(a.response,Object.assign({},e,a)))},onerror:a=>{console.log("err",a),d(new Response(a.response,Object.assign({},e,a)))}}))});return d});
{
"name": "gmxhr-fetch",
"version": "0.1.0",
"version": "0.1.1",
"description": "fetch-like wrapper for GM_xmlhttpRequest.",

@@ -5,0 +5,0 @@ "main": "gmxhr-fetch.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc