Skip to content

Commit 5e2f0b3

Browse files
authored
Update @sindresorhus/is to v7 (#2363)
1 parent 3c3b233 commit 5e2f0b3

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"ky"
4949
],
5050
"dependencies": {
51-
"@sindresorhus/is": "^6.3.1",
51+
"@sindresorhus/is": "^7.0.0",
5252
"@szmarczak/http-timer": "^5.0.1",
5353
"cacheable-lookup": "^7.0.0",
5454
"cacheable-request": "^12.0.1",

source/core/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ export default class Request extends Duplex implements RequestEvents<Request> {
10751075
if (is.undefined(headers[key])) {
10761076
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
10771077
delete headers[key];
1078-
} else if (is.null_(headers[key])) {
1078+
} else if (is.null(headers[key])) {
10791079
throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${key}\` header`);
10801080
}
10811081
}

source/core/options.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ function validateSearchParameters(searchParameters: Record<string, unknown>): as
622622
for (const key in searchParameters) {
623623
const value = searchParameters[key];
624624

625-
assert.any([is.string, is.number, is.boolean, is.null_, is.undefined], value);
625+
assert.any([is.string, is.number, is.boolean, is.null, is.undefined], value);
626626
}
627627
}
628628

@@ -1102,7 +1102,7 @@ export default class Options {
11021102
}
11031103

11041104
set request(value: RequestFunction | undefined) {
1105-
assert.any([is.function_, is.undefined], value);
1105+
assert.any([is.function, is.undefined], value);
11061106

11071107
this._internals.request = value;
11081108
}
@@ -1474,8 +1474,8 @@ export default class Options {
14741474

14751475
let {setCookie, getCookieString} = value;
14761476

1477-
assert.function_(setCookie);
1478-
assert.function_(getCookieString);
1477+
assert.function(setCookie);
1478+
assert.function(getCookieString);
14791479

14801480
/* istanbul ignore next: Horrible `tough-cookie` v3 check */
14811481
if (setCookie.length === 4 && getCookieString.length === 0) {
@@ -1635,7 +1635,7 @@ export default class Options {
16351635
}
16361636

16371637
set dnsLookup(value: CacheableLookup['lookup'] | undefined) {
1638-
assert.any([is.function_, is.undefined], value);
1638+
assert.any([is.function, is.undefined], value);
16391639

16401640
this._internals.dnsLookup = value;
16411641
}
@@ -1735,7 +1735,7 @@ export default class Options {
17351735

17361736
if (hooks) {
17371737
for (const hook of hooks) {
1738-
assert.function_(hook);
1738+
assert.function(hook);
17391739
}
17401740
}
17411741

@@ -1770,7 +1770,7 @@ export default class Options {
17701770
}
17711771

17721772
set followRedirect(value: boolean | ((response: PlainResponse) => boolean)) {
1773-
assert.any([is.boolean, is.function_], value);
1773+
assert.any([is.boolean, is.function], value);
17741774

17751775
this._internals.followRedirect = value;
17761776
}
@@ -2013,7 +2013,7 @@ export default class Options {
20132013
}
20142014

20152015
set parseJson(value: ParseJsonFunction) {
2016-
assert.function_(value);
2016+
assert.function(value);
20172017

20182018
this._internals.parseJson = value;
20192019
}
@@ -2064,7 +2064,7 @@ export default class Options {
20642064
}
20652065

20662066
set stringifyJson(value: StringifyJsonFunction) {
2067-
assert.function_(value);
2067+
assert.function(value);
20682068

20692069
this._internals.stringifyJson = value;
20702070
}
@@ -2098,7 +2098,7 @@ export default class Options {
20982098
set retry(value: Partial<RetryOptions>) {
20992099
assert.plainObject(value);
21002100

2101-
assert.any([is.function_, is.undefined], value.calculateDelay);
2101+
assert.any([is.function, is.undefined], value.calculateDelay);
21022102
assert.any([is.number, is.undefined], value.maxRetryAfter);
21032103
assert.any([is.number, is.undefined], value.limit);
21042104
assert.any([is.array, is.undefined], value.methods);
@@ -2164,7 +2164,7 @@ export default class Options {
21642164
}
21652165

21662166
set createConnection(value: CreateConnectionFunction | undefined) {
2167-
assert.any([is.function_, is.undefined], value);
2167+
assert.any([is.function, is.undefined], value);
21682168

21692169
this._internals.createConnection = value;
21702170
}
@@ -2210,7 +2210,7 @@ export default class Options {
22102210
assert.plainObject(value);
22112211

22122212
assert.any([is.boolean, is.undefined], value.rejectUnauthorized);
2213-
assert.any([is.function_, is.undefined], value.checkServerIdentity);
2213+
assert.any([is.function, is.undefined], value.checkServerIdentity);
22142214
assert.any([is.string, is.object, is.array, is.undefined], value.certificateAuthority);
22152215
assert.any([is.string, is.object, is.array, is.undefined], value.key);
22162216
assert.any([is.string, is.object, is.array, is.undefined], value.certificate);

source/core/utils/is-form-data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ type FormData = {
77
} & Readable;
88

99
export default function isFormData(body: unknown): body is FormData {
10-
return is.nodeStream(body) && is.function_((body as FormData).getBoundary);
10+
return is.nodeStream(body) && is.function((body as FormData).getBoundary);
1111
}

source/create.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const delay = async (ms: number) => new Promise(resolve => {
2222
setTimeout(resolve, ms);
2323
});
2424

25-
const isGotInstance = (value: Got | ExtendOptions): value is Got => is.function_(value);
25+
const isGotInstance = (value: Got | ExtendOptions): value is Got => is.function(value);
2626

2727
const aliases: readonly HTTPAlias[] = [
2828
'get',
@@ -134,10 +134,10 @@ const create = (defaults: InstanceDefaults): Got => {
134134

135135
const {pagination} = normalizedOptions;
136136

137-
assert.function_(pagination.transform);
138-
assert.function_(pagination.shouldContinue);
139-
assert.function_(pagination.filter);
140-
assert.function_(pagination.paginate);
137+
assert.function(pagination.transform);
138+
assert.function(pagination.shouldContinue);
139+
assert.function(pagination.filter);
140+
assert.function(pagination.paginate);
141141
assert.number(pagination.countLimit);
142142
assert.number(pagination.requestLimit);
143143
assert.number(pagination.backoff);

test/create.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ test('async handlers', withServer, async (t, server, got) => {
329329
});
330330

331331
const promise = instance('');
332-
t.true(is.function_(promise.cancel));
332+
t.true(is.function(promise.cancel));
333333
// @ts-expect-error Manual tests
334334
t.true((await promise).modified);
335335
});

test/stream.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ test('check for pipe method', withServer, (t, server, got) => {
178178
server.get('/', defaultHandler);
179179

180180
const stream = got.stream('');
181-
t.true(is.function_(stream.pipe));
182-
t.true(is.function_(stream.on('foobar', () => {}).pipe));
181+
t.true(is.function(stream.pipe));
182+
t.true(is.function(stream.on('foobar', () => {}).pipe));
183183

184184
stream.destroy();
185185
});

0 commit comments

Comments
 (0)