Skip to content

Commit

Permalink
Use strict types
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 7, 2021
1 parent 3cce987 commit eb831d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import {trigram} from 'n-gram'
import {collapseWhiteSpace} from 'collapse-white-space'

/**
* @typedef {[string, number]} TrigramTuple
* @typedef {TrigramTuple[]} TrigramTuples
* @typedef {Object.<string, number>} TrigramDictionary
* @typedef {Record<string, number>} TrigramDictionary
*/

import {trigram} from 'n-gram'
import {collapseWhiteSpace} from 'collapse-white-space'

const own = {}.hasOwnProperty

/**
* Clean `value`.
* Removed general non-important (as in, for language detection) punctuation
* marks, symbols, and digits.
*
* @param {string} [value]
* @param {string|null} [value]
* @returns {string}
*/
export function clean(value) {
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
"xo": "^0.46.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"prepublishOnly": "npm run build && npm run format",
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
Expand All @@ -70,6 +70,7 @@
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true
"strict": true,
"ignoreCatch": true
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"files": ["index.js"],
"include": ["*.js"],
"compilerOptions": {
"target": "ES2020",
Expand All @@ -11,6 +10,7 @@
"declaration": true,
"emitDeclarationOnly": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
"skipLibCheck": true,
"strict": true
}
}

0 comments on commit eb831d1

Please sign in to comment.