This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update assets * Upgrade linting and other improvments * Correct linting * Correction and type check improvements * Correct type check lib * Fix lint pathing for VSCode * Remove duplicate babel config * Remove editorconfig root attribute from web subdir * Use double quotes around message * Simplify ESLint config * Update web assets * Allow AMD loader in WebPack * Bump web dependencies * Only include FA icons in-use
- Loading branch information
1 parent
c79d4cf
commit ff5b1cb
Showing
17 changed files
with
8,520 additions
and
5,747 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
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
insert_final_newline = true | ||
|
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,38 +1,40 @@ | ||
{ | ||
"parser": "@babel/eslint-parser", | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"es2017": true, | ||
"es2020": true, | ||
"es2021": true, | ||
"jquery": true | ||
}, | ||
"plugins": [ | ||
"node", | ||
"@babel", | ||
"import", | ||
"jsdoc" | ||
"jsdoc", | ||
"jquery" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"google", | ||
"plugin:node/recommended-module", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:jsdoc/recommended" | ||
"plugin:jsdoc/recommended", | ||
"plugin:jquery/deprecated" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"require-jsdoc": "off", | ||
"valid-jsdoc": "off", | ||
"jsdoc/require-jsdoc": "off", | ||
"max-len": ["warn", { | ||
"code": 120 | ||
}], | ||
"linebreak-style": "off", | ||
"jsdoc/require-jsdoc": "off", | ||
"import/unambiguous": "error", | ||
"import/no-commonjs": "error", | ||
"import/no-amd": "error", | ||
"linebreak-style": "off" | ||
"import/no-nodejs-modules": "error", | ||
"import/no-deprecated": "error", | ||
"import/extensions": ["error", "always"], | ||
"import/no-unresolved": ["error", { | ||
"commonjs": true | ||
}] | ||
} | ||
} |
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 @@ | ||
package-lock.json text eol=lf |
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,2 @@ | ||
node_modules/ | ||
!* | ||
node_modules/ |
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,5 @@ | ||
{ | ||
"plugins": [ | ||
"@babel/plugin-proposal-class-properties" | ||
] | ||
} |
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,42 @@ | ||
import {validateString, validateNumber} from './type.mjs'; | ||
|
||
/** | ||
* Truncate string length by characters. | ||
* | ||
* @param {string} text String to format. | ||
* @param {number} limit Maximum number of characters in resulting string. | ||
* @param {string} ending Ending to use if string is trucated. | ||
* | ||
* @returns {string} Formatted string. | ||
*/ | ||
export function limitChars(text, limit = 50, ending = '...') { | ||
validateString(text); | ||
validateNumber(limit); | ||
validateString(ending); | ||
|
||
// Check if string is already below limit | ||
if (text.length <= limit) { | ||
return text; | ||
} | ||
|
||
// Limit string length by characters | ||
return text.substring(0, limit - ending.length) + ending; | ||
} | ||
|
||
/** | ||
* Truncate string length by words. | ||
* | ||
* @param {string} text String to format. | ||
* @param {number} limit Maximum number of words in resulting string. | ||
* @param {string} ending Ending to use if string is trucated. | ||
* | ||
* @returns {string} Formatted string. | ||
*/ | ||
export function limitWords(text, limit = 10, ending = '...') { | ||
validateString(text); | ||
validateNumber(limit); | ||
validateString(ending); | ||
|
||
// Limit string length by words | ||
return text.split(' ').splice(0, limit).join(' ') + ending; | ||
} |
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,65 @@ | ||
/** | ||
* Checks if `value` is the type `Object` excluding `Function` and `null` | ||
* | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an object, otherwise `false`. | ||
*/ | ||
export function isObject(value) { | ||
return (Object.prototype.toString.call(value) === '[object Object]'); | ||
} | ||
|
||
/** | ||
* Checks if `value` is the type `string` | ||
* | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a string, otherwise `false`. | ||
*/ | ||
export function isString(value) { | ||
return (typeof value === 'string'); | ||
} | ||
|
||
/** | ||
* Checks if `value` is the type `number` | ||
* | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a number, otherwise `false`. | ||
*/ | ||
export function isNumber(value) { | ||
return (typeof value === 'number'); | ||
} | ||
|
||
/** | ||
* Validate parameter is of type object. | ||
* | ||
* @param {string} value Variable to validate. | ||
* @throws Error if not an object. | ||
*/ | ||
export function validateObject(value) { | ||
if (!isObject(value)) { | ||
throw new TypeError('Parameter "value" must be of type object.'); | ||
} | ||
} | ||
|
||
/** | ||
* Validate parameter is of type string. | ||
* | ||
* @param {string} value Variable to validate. | ||
* @throws Error if not an string. | ||
*/ | ||
export function validateString(value) { | ||
if (!isString(value)) { | ||
throw new TypeError('Parameter "value" must be of type string.'); | ||
} | ||
} | ||
|
||
/** | ||
* Validate parameter is of type number. | ||
* | ||
* @param {number} value Variable to validate. | ||
* @throws Error if not an number. | ||
*/ | ||
export function validateNumber(value) { | ||
if (!isNumber(value)) { | ||
throw new TypeError('Parameter "value" must be of type number.'); | ||
} | ||
} |
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
Oops, something went wrong.