-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate to TypeScript * Add .codebeatignore * Remove demo folder * Update README * Add tests * Fix ESLint config * Remove unused file
- Loading branch information
Showing
20 changed files
with
1,686 additions
and
1,918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"TYPESCRIPT": { | ||
"ABC": [ | ||
20, | ||
40, | ||
80, | ||
120 | ||
], | ||
"LOC": [ | ||
50, | ||
80, | ||
120, | ||
160 | ||
], | ||
"TOTAL_LOC": [ | ||
400, | ||
500, | ||
640, | ||
900 | ||
], | ||
"BLOCK_NESTING": [ | ||
6, | ||
8, | ||
10, | ||
12 | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"browser": true | ||
}, | ||
"extends": ["prettier", "plugin:@typescript-eslint/recommended"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig-compile.json", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"ignorePatterns": ["*.js", "*.mjs", "dist/*"], | ||
"rules": { | ||
"@typescript-eslint/no-this-alias": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,5 @@ node_modules/ | |
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ node_js: | |
install: | ||
- yarn | ||
script: | ||
- yarn lint | ||
- yarn test | ||
- yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"checkRunSettings": { | ||
"vulnerableCheckRunConclusionLevel": "success" | ||
}, | ||
"issueSettings": { | ||
"minSeverityLevel": "LOW" | ||
} | ||
"generalSettings": { | ||
"shouldScanRepo": true | ||
}, | ||
"checkRunSettings": { | ||
"vulnerableCheckRunConclusionLevel": "success" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins: | ||
- jekyll-relative-links | ||
relative_links: | ||
enabled: true | ||
collections: true | ||
include: | ||
- CONTRIBUTING.md | ||
- README.md | ||
- LICENSE.md | ||
- COPYING.md | ||
- CODE_OF_CONDUCT.md | ||
- CONTRIBUTING.md | ||
- ISSUE_TEMPLATE.md | ||
- PULL_REQUEST_TEMPLATE.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
theme: jekyll-theme-slate | ||
theme: jekyll-theme-slate |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
|
||
export default { | ||
input: 'src/debounce.ts', | ||
output: { | ||
dir: 'dist', | ||
name: 'debounce', | ||
format: 'umd', | ||
exports: 'named', | ||
sourcemap: true | ||
}, | ||
plugins: [ | ||
typescript({ | ||
tsconfig: './tsconfig-compile.json' | ||
}), | ||
commonjs() | ||
] | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export const debounce = function <T extends (...args: unknown[]) => void>( | ||
fn: T, | ||
delay = 15, | ||
isImmediate = false | ||
): <C>(this: C, ...rest: Parameters<T>) => void { | ||
let timeout: ReturnType<typeof setTimeout> | null; | ||
|
||
return function <C>(this: C, ...args: Parameters<T>) { | ||
const context = this; | ||
|
||
if (isImmediate && !timeout) { | ||
fn.apply(context, args); | ||
} | ||
|
||
if (typeof timeout === 'number') { | ||
clearTimeout(timeout); | ||
} | ||
|
||
timeout = setTimeout(() => { | ||
timeout = null; | ||
|
||
if (!isImmediate) { | ||
fn.apply(context, args); | ||
} | ||
}, delay); | ||
}; | ||
}; | ||
|
||
export default debounce; |
Oops, something went wrong.