Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lesca-fetcher

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lesca-fetcher - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

4

lib/index.d.ts

@@ -17,6 +17,6 @@ export declare enum contentType {

install: (setting: Config) => void;
post: (api: String | undefined, data: Object) => Promise<unknown>;
get: (api?: String) => Promise<unknown>;
post: <T>(api: String | undefined, data: Object) => Promise<T> | Promise<string>;
get: <T_1>(api?: String) => Promise<string> | Promise<T_1>;
setJWT: (jwt: string) => void;
};
export default Fetcher;

@@ -57,9 +57,9 @@ "use strict";

}
return new Promise(function (resolve, reject) {
fetch(mergePath(api), {
method: method,
body: body,
headers: headers
}).then(function (res) {
if (format === formatType.JSON) {
if (format === formatType.JSON) {
return new Promise(function (resolve, reject) {
fetch(mergePath(api), {
method: method,
body: body,
headers: headers
}).then(function (res) {
res.json().then(function (e) {

@@ -70,3 +70,13 @@ return resolve(e);

});
} else {
})["catch"](function (e) {
return reject(e);
});
});
} else {
return new Promise(function (resolve, reject) {
fetch(mergePath(api), {
method: method,
body: body,
headers: headers
}).then(function (res) {
res.text().then(function (e) {

@@ -77,7 +87,7 @@ return resolve(e);

});
}
})["catch"](function (e) {
return reject(e);
})["catch"](function (e) {
return reject(e);
});
});
});
}
};

@@ -87,8 +97,8 @@ var get = function get() {

var method = 'GET';
return new Promise(function (resolve, reject) {
fetch(mergePath(api), {
method: method,
headers: headers
}).then(function (res) {
if (format === formatType.JSON) {
if (format === formatType.JSON) {
return new Promise(function (resolve, reject) {
fetch(mergePath(api), {
method: method,
headers: headers
}).then(function (res) {
res.json().then(function (e) {

@@ -99,3 +109,12 @@ return resolve(e);

});
} else {
})["catch"](function (e) {
return reject(e);
});
});
} else {
return new Promise(function (resolve, reject) {
fetch(mergePath(api), {
method: method,
headers: headers
}).then(function (res) {
res.text().then(function (e) {

@@ -106,7 +125,7 @@ return resolve(e);

});
}
})["catch"](function (e) {
return reject(e);
})["catch"](function (e) {
return reject(e);
});
});
});
}
};

@@ -113,0 +132,0 @@ var Fetcher = {

{
"name": "lesca-fetcher",
"version": "1.1.6",
"version": "1.1.7",
"description": "Integrate fetch for easier use",

@@ -22,14 +22,14 @@ "main": "lib/index.js",

"devDependencies": {
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.2",
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.5",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.2",
"@babel/plugin-transform-runtime": "^7.23.4",
"@babel/preset-env": "^7.23.5",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.16",
"@mui/material": "^5.14.17",
"@mui/icons-material": "^5.14.19",
"@mui/material": "^5.14.19",
"autoprefixer": "^10.4.16",

@@ -40,10 +40,10 @@ "babel-loader": "^9.1.3",

"file-loader": "^6.2.0",
"gh-pages": "^6.0.0",
"html-react-parser": "^5.0.6",
"gh-pages": "^6.1.0",
"html-react-parser": "^5.0.7",
"html-webpack-plugin": "^5.5.3",
"lesca-url-parameters": "^2.0.7",
"lesca-url-parameters": "^2.0.8",
"less": "^4.2.0",
"less-loader": "^11.1.3",
"less-vars-to-js": "^1.3.0",
"postcss": "^8.4.31",
"postcss": "^8.4.32",
"postcss-loader": "^7.3.3",

@@ -54,4 +54,4 @@ "prismjs": "^1.29.0",

"style-loader": "^3.3.3",
"ts-loader": "^9.5.0",
"typescript": "^5.2.2",
"ts-loader": "^9.5.1",
"typescript": "^5.3.2",
"webpack": "^5.89.0",

@@ -63,4 +63,4 @@ "webpack-cli": "^5.1.4",

"dependencies": {
"@babel/runtime": "^7.23.2"
"@babel/runtime": "^7.23.5"
}
}

@@ -51,3 +51,3 @@ export enum contentType {

const post = (api: String = '/api', data: Object) => {
const post = <T>(api: String = '/api', data: Object) => {
const method = 'POST';

@@ -62,6 +62,6 @@

return new Promise((resolve, reject) => {
fetch(mergePath(api), { method, body, headers })
.then((res) => {
if (format === formatType.JSON) {
if (format === formatType.JSON) {
return new Promise<T>((resolve, reject) => {
fetch(mergePath(api), { method, body, headers })
.then((res) => {
res

@@ -71,3 +71,9 @@ .json()

.catch((e) => reject(e));
} else {
})
.catch((e) => reject(e));
});
} else {
return new Promise<string>((resolve, reject) => {
fetch(mergePath(api), { method, body, headers })
.then((res) => {
res

@@ -77,15 +83,14 @@ .text()

.catch((e) => reject(e));
}
})
.catch((e) => reject(e));
});
})
.catch((e) => reject(e));
});
}
};
const get = (api: String = '/api') => {
const get = <T>(api: String = '/api') => {
const method = 'GET';
return new Promise((resolve, reject) => {
fetch(mergePath(api), { method, headers })
.then((res) => {
if (format === formatType.JSON) {
if (format === formatType.JSON) {
return new Promise<T>((resolve, reject) => {
fetch(mergePath(api), { method, headers })
.then((res) => {
res

@@ -95,3 +100,9 @@ .json()

.catch((e) => reject(e));
} else {
})
.catch((e) => reject(e));
});
} else {
return new Promise<string>((resolve, reject) => {
fetch(mergePath(api), { method, headers })
.then((res) => {
res

@@ -101,6 +112,6 @@ .text()

.catch((e) => reject(e));
}
})
.catch((e) => reject(e));
});
})
.catch((e) => reject(e));
});
}
};

@@ -107,0 +118,0 @@

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