Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit 6c8416b

Browse files
committed
fix: Typos
1 parent bc0a411 commit 6c8416b

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/fn.set-props.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const { trim, is, isObject } = require("@mutant-ws/m")
1+
const { trim, is, isObject } = require("@asd14/m")
22

33
const setProps = props => ({ baseURL, headers, queryStringifyFn }) => {
44
if (is(queryStringifyFn)) {
55
if (typeof queryStringifyFn === "function") {
66
props.queryStringifyFn = queryStringifyFn
77
} else {
88
throw new TypeError(
9-
`@mutant-ws/fetch-node: "queryStringifyFn" should be a function, received ${JSON.stringify(
9+
`@asd14/fetch-node: "queryStringifyFn" should be a function, received ${JSON.stringify(
1010
queryStringifyFn
1111
)}`
1212
)
@@ -21,7 +21,7 @@ const setProps = props => ({ baseURL, headers, queryStringifyFn }) => {
2121
}
2222
} else {
2323
throw new TypeError(
24-
`@mutant-ws/fetch-node: "headers" should be an object, received ${JSON.stringify(
24+
`@asd14/fetch-node: "headers" should be an object, received ${JSON.stringify(
2525
headers
2626
)}`
2727
)
@@ -30,10 +30,10 @@ const setProps = props => ({ baseURL, headers, queryStringifyFn }) => {
3030

3131
if (is(baseURL)) {
3232
if (typeof baseURL === "string") {
33-
props.baseURL = trim("/")(baseURL)
33+
props.baseURL = trim("/", baseURL)
3434
} else {
3535
throw new TypeError(
36-
`@mutant-ws/fetch-node: "baseURL" should be a string, received ${JSON.stringify(
36+
`@asd14/fetch-node: "baseURL" should be a string, received ${JSON.stringify(
3737
baseURL
3838
)}`
3939
)

src/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
/* eslint-disable import/exports-last */
2-
31
const fetch = require("node-fetch")
42
const FormData = require("form-data")
53
const RFC3986 = require("rfc-3986")
64
const {
7-
get,
5+
read,
86
pipe,
97
reduce,
108
startsWith,
@@ -13,7 +11,7 @@ const {
1311
same,
1412
toLower,
1513
isEmpty,
16-
} = require("@mutant-ws/m")
14+
} = require("@asd14/m")
1715

1816
const { setProps } = require("./fn.set-props")
1917
const { HTTPError } = require("./fn.http-error")
@@ -46,15 +44,15 @@ const request = (
4644
) => {
4745
if (!isEmpty(query) && isEmpty(props.queryStringifyFn)) {
4846
throw new TypeError(
49-
`@mutant-ws/fetch-node: ${method}:${path} - Cannot send query params without providing "queryStringifyFn"`
47+
`@asd14/fetch-node: ${method}:${path} - Cannot send query params without providing "queryStringifyFn"`
5048
)
5149
}
5250

5351
const isPathURI = new RegExp(RFC3986.uri).test(path)
5452

5553
if (isEmpty(props.baseURL) && !isPathURI) {
5654
throw new TypeError(
57-
`@mutant-ws/fetch-node: ${method}:${path} - Cannot make request with non-absolute path and no "baseURL"`
55+
`@asd14/fetch-node: ${method}:${path} - Cannot make request with non-absolute path and no "baseURL"`
5856
)
5957
}
6058

@@ -68,8 +66,7 @@ const request = (
6866
...acc,
6967
[toLower(key)]: value,
7068
},
71-
{}
72-
)(
69+
{},
7370
Object.entries({
7471
accept: "application/json",
7572
"content-type": "application/json",
@@ -79,7 +76,7 @@ const request = (
7976
)
8077

8178
const isReqJSON = pipe(
82-
get("content-type"),
79+
read("content-type"),
8380
startsWith("application/json")
8481
)(HEADERS)
8582

0 commit comments

Comments
 (0)