Skip to content

Commit

Permalink
4.0.6: Object.prototype methods will not ruin the result any more
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Aug 12, 2018
1 parent babc421 commit 56976ce
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ package-lock.json
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
nbproject
thumbs.db
*.*-workspace

# Folders to ignore
.hg
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
## ~ 2018-08-09, Version 4.0.1 - 4.0.5

- **PATCH**: updates README.md about frequent asked quesions from github issues.

## 2018-08-12, Version 4.0.6

- **PATCH**: `Object.prototype` methods will not ruin the result any more.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const NEGATIVE_REPLACERS = [
]

// A simple cache, because an ignore rule only has only one certain meaning
const cache = {}
const cache = Object.create(null)

// @param {pattern}
const make_regex = (pattern, negative, ignorecase) => {
Expand Down Expand Up @@ -335,7 +335,7 @@ class IgnoreBase {
}

_initCache () {
this._cache = {}
this._cache = Object.create(null)
}

// @param {Array.<string>|string|Ignore} pattern
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ignore",
"version": "4.0.5",
"version": "4.0.6",
"description": "Ignore is a manager and filter for .gitignore rules.",
"files": [
"legacy.js",
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ function readPatterns (file) {
}

const cases = [
[
'object prototype',
[
'*',
'!hasOwnProperty',
'!a'
],
{
'hasOwnProperty': 0,
'a/hasOwnProperty': 0,
'toString': 1,
'a/toString': 1
}
],
[
'a and a/',
[
Expand Down

0 comments on commit 56976ce

Please sign in to comment.