+8
-4
| 'use strict'; | ||
| /** | ||
| * The constants as defined by the revised Flesch Reading Ease Formula. | ||
| * Constants. | ||
| */ | ||
| var SENTENCE_WEIGHT = 1.015, | ||
| WORD_WEIGHT = 84.6, | ||
| BASE = 206.835; | ||
| var SENTENCE_WEIGHT, | ||
| WORD_WEIGHT, | ||
| BASE; | ||
| SENTENCE_WEIGHT = 1.015; | ||
| WORD_WEIGHT = 84.6; | ||
| BASE = 206.835; | ||
| /** | ||
@@ -12,0 +16,0 @@ * Get the grade level of a given value according to the Flesch Reading Ease |
+14
-17
| { | ||
| "name": "flesch", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Formula to detect the ease of reading a text according to Flesch Reading Ease (1975)", | ||
@@ -11,10 +11,2 @@ "license": "MIT", | ||
| ], | ||
| "dependencies": {}, | ||
| "devDependencies": { | ||
| "eslint": "^0.8.0", | ||
| "istanbul": "^0.3.0", | ||
| "jscs": "^1.5.0", | ||
| "mocha": "^1.20.0" | ||
| }, | ||
| "author": "Titus Wormer <tituswormer@gmail.com>", | ||
| "repository": { | ||
@@ -24,14 +16,19 @@ "type": "git", | ||
| }, | ||
| "author": "Titus Wormer <tituswormer@gmail.com>", | ||
| "devDependencies": { | ||
| "eslint": "^0.9.0", | ||
| "istanbul": "^0.3.0", | ||
| "jscs": "^1.0.0", | ||
| "mocha": "^2.0.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "node_modules/.bin/_mocha --reporter spec --check-leaks -u exports spec/flesch.spec.js", | ||
| "test-travis": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --check-leaks -u exports spec/flesch.spec.js", | ||
| "test": "node_modules/.bin/_mocha --reporter spec --check-leaks -u exports test.js", | ||
| "test-travis": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --check-leaks -u exports test.js", | ||
| "coverage": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -- test.js", | ||
| "lint-api": "node_modules/.bin/eslint index.js", | ||
| "lint-test": "node_modules/.bin/eslint test.js --env mocha", | ||
| "lint-style": "node_modules/.bin/jscs index.js test.js --reporter=inline", | ||
| "lint": "npm run lint-api && npm run lint-test && npm run lint-style", | ||
| "lint-api": "node_modules/.bin/eslint index.js --env node --env browser --rule 'quotes: [2, single], no-cond-assign: false'", | ||
| "lint-test": "node_modules/.bin/eslint spec/flesch.spec.js --env node --env mocha --rule 'quotes: [2, single], no-loop-func: false'", | ||
| "lint-style": "node_modules/.bin/jscs index.js spec/flesch.spec.js --reporter=inline", | ||
| "install-browser-test": "npm install browserify", | ||
| "build-browser-test": "node_modules/.bin/browserify spec/flesch.spec.js -o spec/browser.spec.js", | ||
| "coverage": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -- spec/flesch.spec.js", | ||
| "make": "npm run lint && npm run coverage" | ||
| } | ||
| } |
+2
-2
@@ -1,2 +0,2 @@ | ||
| # flesch [](https://travis-ci.org/wooorm/flesch) [](https://coveralls.io/r/wooorm/flesch?branch=master) | ||
| # flesch [](https://travis-ci.org/wooorm/flesch) [](https://coveralls.io/r/wooorm/flesch?branch=master) | ||
@@ -83,2 +83,2 @@ Formula to detect the ease of reading a text according to [Flesch Reading Ease](http://en.wikipedia.org/wiki/Flesch–Kincaid_readability_tests#Flesch_Reading_Ease). | ||
| MIT © Titus Wormer | ||
| MIT © [Titus Wormer](http://wooorm.com) |
-136
| { | ||
| "requireCurlyBraces": [ | ||
| "if", | ||
| "else", | ||
| "for", | ||
| "while", | ||
| "do", | ||
| "try", | ||
| "catch" | ||
| ], | ||
| "requireSpaceAfterKeywords": [ | ||
| "if", | ||
| "else", | ||
| "for", | ||
| "while", | ||
| "do", | ||
| "switch", | ||
| "return", | ||
| "try", | ||
| "catch" | ||
| ], | ||
| "requireSpaceBeforeBlockStatements": true, | ||
| "requireParenthesesAroundIIFE": true, | ||
| "requireSpacesInConditionalExpression": true, | ||
| "requireSpacesInFunctionExpression": { | ||
| "beforeOpeningCurlyBrace": true | ||
| }, | ||
| "requireSpacesInAnonymousFunctionExpression": { | ||
| "beforeOpeningRoundBrace": true, | ||
| "beforeOpeningCurlyBrace": true | ||
| }, | ||
| "requireSpacesInNamedFunctionExpression": { | ||
| "beforeOpeningRoundBrace": true, | ||
| "beforeOpeningCurlyBrace": true | ||
| }, | ||
| "requireSpacesInFunctionExpression": { | ||
| "beforeOpeningCurlyBrace": true | ||
| }, | ||
| "requireMultipleVarDecl": true, | ||
| "requireBlocksOnNewline": true, | ||
| "disallowPaddingNewlinesInBlocks": true, | ||
| "disallowEmptyBlocks": true, | ||
| "disallowSpacesInsideObjectBrackets": true, | ||
| "disallowSpacesInsideArrayBrackets": true, | ||
| "disallowSpacesInsideParentheses": true, | ||
| "requireSpacesInsideObjectBrackets": "all", | ||
| "disallowDanglingUnderscores": true, | ||
| "requireSpaceAfterObjectKeys": true, | ||
| "requireCommaBeforeLineBreak": true, | ||
| "requireOperatorBeforeLineBreak": [ | ||
| "?", | ||
| "+", | ||
| "-", | ||
| "/", | ||
| "*", | ||
| "=", | ||
| "==", | ||
| "===", | ||
| "!=", | ||
| "!==", | ||
| ">", | ||
| ">=", | ||
| "<", | ||
| "<=" | ||
| ], | ||
| "requireSpaceBeforeBinaryOperators": [ | ||
| "=", | ||
| ",", | ||
| "+", | ||
| "-", | ||
| "/", | ||
| "*", | ||
| "==", | ||
| "===", | ||
| "!=", | ||
| "!==" | ||
| ], | ||
| "requireSpaceAfterBinaryOperators": [ | ||
| "=", | ||
| ",", | ||
| "+", | ||
| "-", | ||
| "/", | ||
| "*", | ||
| "==", | ||
| "===", | ||
| "!=", | ||
| "!==" | ||
| ], | ||
| "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], | ||
| "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], | ||
| "requireSpaceBeforeBinaryOperators": [ | ||
| "+", | ||
| "-", | ||
| "/", | ||
| "*", | ||
| "=", | ||
| "==", | ||
| "===", | ||
| "!=", | ||
| "!==" | ||
| ], | ||
| "requireSpaceAfterBinaryOperators": [ | ||
| "+", | ||
| "-", | ||
| "/", | ||
| "*", | ||
| "=", | ||
| "==", | ||
| "===", | ||
| "!=", | ||
| "!==" | ||
| ], | ||
| "disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"], | ||
| "requireCamelCaseOrUpperCaseIdentifiers": true, | ||
| "disallowKeywords": ["with"], | ||
| "disallowMultipleLineStrings": true, | ||
| "disallowMultipleLineBreaks": true, | ||
| "validateLineBreaks": "LF", | ||
| "validateQuoteMarks": "'", | ||
| "disallowMixedSpacesAndTabs": true, | ||
| "disallowTrailingWhitespace": true, | ||
| "disallowTrailingComma": true, | ||
| "disallowKeywordsOnNewLine": ["else"], | ||
| "requireLineFeedAtFileEnd": true, | ||
| "maximumLineLength": 78, | ||
| "requireCapitalizedConstructors": true, | ||
| "safeContextKeyword": "self", | ||
| "requireDotNotation": true, | ||
| "disallowYodaConditions": true, | ||
| "validateJSDoc": { | ||
| "checkParamNames": true, | ||
| "checkRedundantParams": true, | ||
| "requireParamTypes": true | ||
| } | ||
| } |
Sorry, the diff of this file is not supported yet
-28
| { | ||
| "name": "flesch", | ||
| "main": "index.js", | ||
| "description": "Formula to detect the ease of reading a text according to Flesch Reading Ease (1975)", | ||
| "license": "MIT", | ||
| "keywords": [ | ||
| "flesch", | ||
| "readability", | ||
| "formula" | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/wooorm/flesch.git" | ||
| }, | ||
| "authors": [ | ||
| "Titus Wormer <tituswormer@gmail.com>" | ||
| ], | ||
| "ignore": [ | ||
| ".*", | ||
| "*.log", | ||
| "*.md", | ||
| "component.json", | ||
| "package.json", | ||
| "coverage", | ||
| "node_modules", | ||
| "spec" | ||
| ] | ||
| } |
| { | ||
| "name": "flesch", | ||
| "version": "0.0.1", | ||
| "description": "Formula to detect the ease of reading a text according to Flesch Reading Ease (1975)", | ||
| "license": "MIT", | ||
| "keywords": [ | ||
| "flesch", | ||
| "readability", | ||
| "formula" | ||
| ], | ||
| "scripts": [ | ||
| "index.js" | ||
| ], | ||
| "repository": "wooorm/flesch" | ||
| } |
| 'use strict'; | ||
| /** | ||
| * Module dependencies (flesch, assert). | ||
| */ | ||
| var flesch = require('..'), | ||
| assert = require('assert'); | ||
| /** | ||
| * Assert, but up to 6 digits. | ||
| */ | ||
| function roundAssert(a, b) { | ||
| assert(Math.round(a * 1000000) === Math.round(b * 1000000)); | ||
| } | ||
| /** | ||
| * Unit tests. | ||
| */ | ||
| describe('flesch()', function () { | ||
| it('should be of type `function`', function () { | ||
| assert(typeof flesch === 'function'); | ||
| }); | ||
| it('should work', function () { | ||
| var result; | ||
| /** | ||
| * Return NaN when an invalid value is given. | ||
| */ | ||
| result = flesch(); | ||
| assert(result !== result); | ||
| /** | ||
| * The cat sat on the mat | ||
| * | ||
| * Sentences: 1 | ||
| * Words: 6 | ||
| * Syllables: 6 | ||
| */ | ||
| roundAssert(flesch({ | ||
| 'sentence' : 1, | ||
| 'word' : 6, | ||
| 'syllable' : 6 | ||
| }), 116.145); | ||
| /** | ||
| * This sentence, taken as a reading passage unto itself, is being | ||
| * used to prove a point. | ||
| * | ||
| * Sentences: 1 | ||
| * Words: 16 | ||
| * Syllables: 22 | ||
| */ | ||
| roundAssert(flesch({ | ||
| 'sentence' : 1, | ||
| 'word' : 16, | ||
| 'syllable' : 22 | ||
| }), 74.27); | ||
| /** | ||
| * The Australian platypus is seemingly a hybrid of a mammal and | ||
| * reptilian creature. | ||
| * | ||
| * Sentences: 1 | ||
| * Words: 13 | ||
| * Syllables: 26 | ||
| */ | ||
| roundAssert(flesch({ | ||
| 'sentence' : 1, | ||
| 'word' : 13, | ||
| 'syllable' : 26 | ||
| }), 24.44); | ||
| }); | ||
| }); |
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> | ||
| </head> | ||
| <body> | ||
| <div id="mocha"></div> | ||
| <script src="../node_modules/mocha/mocha.js"></script> | ||
| <script> | ||
| mocha.ui('bdd'); | ||
| mocha.reporter('html'); | ||
| </script> | ||
| <script src="browser.spec.js" onload="window.scriptDidLoad=true;void 0"></script> | ||
| <script> | ||
| mocha.run(); | ||
| window.setTimeout(function () { | ||
| if (!('scriptDidLoad' in window)) { | ||
| document.getElementById('mocha').innerHTML = '<h1>' + | ||
| 'Woops, an error occured!</h1>' + | ||
| '<p>' + | ||
| 'Did you forget to execute either:<br />' + | ||
| '<pre><code>$ npm run install-browser-test</code><br /></pre>' + | ||
| 'or <br/>' + | ||
| '<pre><code>$ npm run build-browser-test</code></pre>' + | ||
| '?' + | ||
| '</p>' | ||
| } | ||
| }, 100); | ||
| </script> | ||
| </body> | ||
| </html> |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6066
-53.83%4
-63.64%35
-87.36%1
Infinity%