no-cliches
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -1,2 +0,2 @@ | ||
var cliches = [ | ||
const cliches = [ | ||
'a chip off the old block', | ||
@@ -701,7 +701,7 @@ 'a clean slate', | ||
var clicheRegex = new RegExp('\\b(' + cliches.join('|') + ')\\b', 'gi'); | ||
var matcher = require("./matcher"); | ||
const clicheRegex = new RegExp(`\\b(${cliches.join('|')})\\b`, 'gi'); | ||
const matcher = require('./matcher'); | ||
module.exports = function (text) { | ||
return matcher(clicheRegex, text, "clichés"); | ||
module.exports = function clichesMatcher(text) { | ||
return matcher(clicheRegex, text); | ||
}; |
@@ -1,11 +0,13 @@ | ||
var matcher = function(regex, text, type) { | ||
var results = []; | ||
function matcher(regex, text) { | ||
const results = []; | ||
let result = regex.exec(text); | ||
while (result = regex.exec(text)) { | ||
results.push({index: result.index, offset: result[0].length}); | ||
while (result) { | ||
results.push({ index: result.index, offset: result[0].length }); | ||
result = regex.exec(text); | ||
} | ||
return results; | ||
}; | ||
} | ||
module.exports = matcher; |
{ | ||
"name": "no-cliches", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Find clichés in your writings", | ||
"main": "cliches.js", | ||
"homepage": "https://github.com/duereg/no-cliches", | ||
"author": "Matt Blair", | ||
"author": { | ||
"name": "Matt Blair", | ||
"url": "blog.mattblair.co", | ||
"email": "" | ||
}, | ||
"engines": { | ||
"node": ">=6", | ||
"npm": ">=5" | ||
}, | ||
"bugs": { | ||
@@ -32,4 +40,9 @@ "url": "https://github.com/duereg/no-cliches/issues" | ||
"devDependencies": { | ||
"jasmine-node": "^2.0.1" | ||
"jasmine-node": "^2.0.1", | ||
"eslint": "^5.12.0", | ||
"eslint-config-airbnb": "^17.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jsx-a11y": "^6.1.2", | ||
"eslint-plugin-react": "^7.12.3" | ||
} | ||
} |
@@ -1,22 +0,22 @@ | ||
var cliches = require('../cliches'); | ||
var clichesInSentence = 'Writing specs puts me at loose ends.'; | ||
var goodSentence = 'The good dog jumps over the bad cat.'; | ||
const cliches = require('../cliches'); | ||
describe('no-cliches', function () { | ||
const clichesInSentence = 'Writing specs puts me at loose ends.'; | ||
const goodSentence = 'The good dog jumps over the bad cat.'; | ||
describe('a sentence filled with cliches', function() { | ||
var results = null; | ||
describe('no-cliches', () => { | ||
describe('a sentence filled with cliches', () => { | ||
let results = null; | ||
beforeEach(function() { | ||
beforeEach(() => { | ||
results = cliches(clichesInSentence); | ||
}); | ||
it('will not escape notice', function () { | ||
expect(results).toEqual([{ index : 22, offset : 13 }]); | ||
it('will not escape notice', () => { | ||
expect(results).toEqual([{ index: 22, offset: 13 }]); | ||
}); | ||
}) | ||
}); | ||
it('should not have a problem with a short sentence', function () { | ||
it('should not have a problem with a short sentence', () => { | ||
expect(cliches(goodSentence)).toEqual([]); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21203
9
731
6