Skip to content

Commit

Permalink
Fix declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Apr 5, 2019
1 parent 0065fca commit cece732
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 5 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

import sep from 'path';

// * @param {Array|Function|String|RegExp} matchers
// * @param {String=} testString
// * @param {Boolean=} returnIndex

type AnymatchPattern = String|RegExp|{(string:String): Boolean};
type AnymatchPattern = string|RegExp|{(string:string): boolean};
type AnymatchMatcher = AnymatchPattern|Array<AnymatchPattern>
function anymatch(matchers: AnymatchMatcher, testString: String): Boolean;
function anymatch(matchers: AnymatchMatcher, testString: String, returnIndex: Boolean): Number;
function anymatch(matchers: AnymatchMatcher): (testString: String) => Boolean;
function anymatch(matchers: AnymatchMatcher): (testString: String, returnIndex: Boolean) => Number;
declare function anymatch(matchers: AnymatchMatcher, testString: string): boolean;
declare function anymatch(matchers: AnymatchMatcher, testString: string, returnIndex: boolean): number;
declare function anymatch(matchers: AnymatchMatcher): (testString: string) => boolean;
declare function anymatch(matchers: AnymatchMatcher): (testString: string, returnIndex: boolean) => number;
export = anymatch;
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const normalizePath = require('normalize-path');
const {sep} = require('path'); // required for tests.

/**
* @typedef {(string:String) => Boolean} AnymatchStrBoolFn
* @typedef {String|RegExp|AnymatchStrBoolFn} AnymatchPattern
* @typedef {(string:String) => boolean} AnymatchStrBoolFn
* @typedef {string|RegExp|AnymatchStrBoolFn} AnymatchPattern
* @typedef {AnymatchPattern|Array<AnymatchPattern>} AnymatchMatcher
*/

Expand Down Expand Up @@ -35,7 +35,7 @@ const createPattern = (matcher) => (string) => {
* @param {AnymatchMatcher} matchers
* @param {String} testString
* @param {Boolean=} returnIndex
* @returns {Boolean|Number|Function}
* @returns {boolean|Number|Function}
*/
const anymatch = (matchers, testString, returnIndex = false) => {
if (matchers == null) {
Expand Down

0 comments on commit cece732

Please sign in to comment.