Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 11, 2022
1 parent 4942c16 commit 2fe2386
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 27 deletions.
27 changes: 12 additions & 15 deletions package.json
Expand Up @@ -21,7 +21,7 @@
"docs": "typedoc source/index.ts",
"build": "del-cli dist && tsc",
"prepare": "npm run build",
"//postpublish": "npm run docs && gh-pages --dist docs --no-history --message \"Deploy documentation\"",
"postpublish": "npm run docs && gh-pages --dist docs --no-history --message \"Deploy documentation\"",
"example": "npm run build && node example.js"
},
"files": [
Expand Down Expand Up @@ -49,7 +49,7 @@
"object"
],
"dependencies": {
"@sindresorhus/is": "^4.6.0",
"@sindresorhus/is": "^5.0.1",
"callsites": "^4.0.0",
"dot-prop": "^7.2.0",
"lodash.isequal": "^4.5.0",
Expand All @@ -59,25 +59,23 @@
"devDependencies": {
"@sindresorhus/tsconfig": "^3.0.1",
"@types/lodash.isequal": "^4.5.6",
"@types/node": "^17.0.36",
"@types/node": "^17.0.42",
"@types/vali-date": "^1.0.0",
"ava": "^4.2.0",
"ava": "^4.3.0",
"c8": "^7.11.3",
"del-cli": "^4.0.1",
"expect-type": "^0.13.0",
"gh-pages": "^4.0.0",
"ts-node": "^10.8.0",
"typescript": "^4.7.2",
"xo": "^0.49.0"
"ts-node": "^10.8.1",
"typedoc": "^0.22.17",
"typescript": "^4.7.3",
"xo": "^0.50.0"
},
"browser": {
"./dist/utils/infer-label.js": "./dist/utils/infer-label.browser.js"
},
"sideEffects": false,
"xo": {
"parserOptions": {
"project": "./tsconfig.xo.json"
},
"ignores": [
"example.js",
"dev-only.js",
Expand All @@ -95,17 +93,16 @@
}
},
"ava": {
"nodeArguments": [
"--loader=ts-node/esm",
"--experimental-specifier-resolution=node"
],
"files": [
"test/**",
"!test/fixtures/**"
],
"extensions": {
"ts": "module"
}
},
"nodeArguments": [
"--loader=ts-node/esm"
]
},
"c8": {
"reporter": [
Expand Down
2 changes: 1 addition & 1 deletion source/index.ts
Expand Up @@ -116,7 +116,7 @@ const ow = <T>(value: unknown, labelOrPredicate: unknown, predicate?: BasePredic

Object.defineProperties(ow, {
isValid: {
value(value: unknown, predicate: BasePredicate<T>): boolean {
value<T>(value: unknown, predicate: BasePredicate<T>): boolean {
try {
test(value, '', predicate);
return true;
Expand Down
2 changes: 1 addition & 1 deletion source/predicates/error.ts
Expand Up @@ -25,7 +25,7 @@ export class ErrorPredicate extends Predicate<Error> {
@param expected - Expected message of the Error.
*/
message(expected: string): this {
override message(expected: string): this {
return this.addValidator({
message: (error, label) => `Expected ${label} message to be \`${expected}\`, got \`${error.message}\``,
validator: error => error.message === expected,
Expand Down
5 changes: 2 additions & 3 deletions source/utils/infer-label.ts
Expand Up @@ -51,14 +51,13 @@ export const inferLabel = (callsites: readonly CallSite[]): void | string => {
line = line.slice(columnNumber - 1);

const match = labelRegex.exec(line);
const token = match?.groups?.['label'];

if (!match?.groups?.label) {
if (!token) {
// Exit if we didn't find a label
return;
}

const token = match.groups.label;

if (isValidIdentifier(token) || isValidIdentifier(token.split('.').pop())) {
return token;
}
Expand Down
2 changes: 1 addition & 1 deletion source/utils/node/is-node.ts
@@ -1,2 +1,2 @@
// eslint-disable-next-line node/prefer-global/process
// eslint-disable-next-line n/prefer-global/process
export default Boolean(process?.versions?.node);
5 changes: 5 additions & 0 deletions tsconfig.json
Expand Up @@ -6,6 +6,11 @@
"include": [
"source"
],
"ts-node": {
"transpileOnly": true,
"files": true,
"experimentalResolver": true
},
"typedocOptions": {
"out": "docs",
"excludePrivate": true,
Expand Down
6 changes: 0 additions & 6 deletions tsconfig.xo.json

This file was deleted.

0 comments on commit 2fe2386

Please sign in to comment.