diff --git a/minimatch.js b/minimatch.js index 71c96a1f..9e8917a4 100644 --- a/minimatch.js +++ b/minimatch.js @@ -243,7 +243,7 @@ class Minimatch { negateOffset++ } - if (negateOffset) this.pattern = pattern.substr(negateOffset) + if (negateOffset) this.pattern = pattern.slice(negateOffset) this.negate = negate } @@ -619,7 +619,7 @@ class Minimatch { } catch (er) { // not a valid class! sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + re = re.substring(0, reClassStart) + '\\[' + sp[0] + '\\]' hasMagic = hasMagic || sp[1] inClass = false continue @@ -652,9 +652,9 @@ class Minimatch { // this is a huge pita. We now have to re-walk // the contents of the would-be class to re-translate // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) + cs = pattern.slice(classStart + 1) sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + re = re.substring(0, reClassStart) + '\\[' + sp[0] hasMagic = hasMagic || sp[1] } diff --git a/test/escaping.js b/test/escaping.js index 66c4012b..86f05c99 100644 --- a/test/escaping.js +++ b/test/escaping.js @@ -10,7 +10,7 @@ var pre = 'x' // prepended to the testable character var post = 'y' // appended to the testable character function escapeChar (cc) { - return '"\\u' + ('000' + cc.toString(16).toUpperCase()).substr(-4) + '"' + return '"\\u' + ('000' + cc.toString(16).toUpperCase()).slice(-4) + '"' } tap.test('escaping tests', function (t) {