Skip to content

Commit

Permalink
bump version 3.3.10
Browse files Browse the repository at this point in the history
typescript: fixes the return value of createFilter()

related to #39

fixes #29
  • Loading branch information
kaelzhang committed Jun 21, 2018
1 parent 5935d94 commit 26e75d8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# test
test/ts/*.js

# coverage
coverage
.nyc_output
Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ interface Ignore {
*/
filter(paths: string[]): string[]
/**
* Creates a filter function which could filter
* Creates a filter function which could filter
* an array of paths with Array.prototype.filter.
*/
createFilter(): (path: string) => Ignore
createFilter(): (path: string) => boolean

/**
* Returns Boolean whether pathname should be ignored.
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ignore",
"version": "3.3.9",
"version": "3.3.10",
"description": "Ignore is a manager and filter for .gitignore rules.",
"main": "./ignore.js",
"files": [
Expand All @@ -10,8 +10,9 @@
"scripts": {
"prepublish": "npm run build",
"build": "babel -o ignore.js index.js",
"test": "npm run build && istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec ./test/ignore.js && codecov",
"test-no-cov": "npm run build && mocha --reporter spec ./test/ignore.js",
"tsc": "tsc ./test/ts/simple.ts",
"test": "npm run tsc && npm run build && istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec ./test/ignore.js && codecov",
"test-no-cov": "npm run tsc && npm run build && mocha --reporter spec ./test/ignore.js",
"cov-report": "istanbul report"
},
"repository": {
Expand Down Expand Up @@ -49,6 +50,7 @@
"pre-suf": "^1.0.4",
"rimraf": "^2.6.2",
"spawn-sync": "^1.0.15",
"tmp": "0.0.33"
"tmp": "0.0.33",
"typescript": "^2.9.2"
}
}
28 changes: 28 additions & 0 deletions test/ts/simple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import ignore from '../../'

const paths = ['a', 'a/b', 'foo/bar']

let ig = ignore()

ig = ig.add('*')
ig = ig.add(['!*/', '!foo/bar'])

const filter = ig.createFilter()
paths.filter(filter)
const passed: boolean = filter('a')

const filtered_paths: Array<string> = ig.filter(paths)
const ignores: boolean = ig.ignores('a')

let ig2 = ignore()

ig2 = ig2.add('# test ig.add(Ignore)')
ig2 = ig2.add(ig)

let ig3 = ignore()
ig3 = ig3.add('*.js')

let ig4 = ignore()
ig4 = ig4.add('*.png')

ig2 = ig2.add([ig3, ig4])

0 comments on commit 26e75d8

Please sign in to comment.