Docs update

This commit is contained in:
Francisco Hodge
2018-10-30 23:33:29 -04:00
parent 288fcf3507
commit e7284b0e38
16 changed files with 136331 additions and 113895 deletions
+18 -7
View File
@@ -52,6 +52,17 @@ class Utilities {
* @type {object} A simple-keyboard instance
*/
this.simpleKeyboardInstance = simpleKeyboardInstance;
/**
* Bindings
*/
this.getButtonClass = this.getButtonClass.bind(this);
this.getButtonDisplayName = this.getButtonDisplayName.bind(this);
this.getUpdatedInput = this.getUpdatedInput.bind(this);
this.updateCaretPos = this.updateCaretPos.bind(this);
this.isMaxLengthReached = this.isMaxLengthReached.bind(this);
this.camelCase = this.camelCase.bind(this);
this.countInArray = this.countInArray.bind(this);
}
/**
@@ -60,7 +71,7 @@ class Utilities {
* @param {string} button The button's layout name
* @return {string} The classes to be added to the button
*/
getButtonClass = button => {
getButtonClass(button){
let buttonTypeClass = (button.includes("{") && button.includes("}") && button !== '{//}') ? "functionBtn" : "standardBtn";
let buttonWithoutBraces = button.replace("{", "").replace("}", "");
let buttonNormalized = '';
@@ -144,7 +155,7 @@ class Utilities {
* @param {object} display The provided display option
* @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
*/
getButtonDisplayName = (button, display, mergeDisplay) => {
getButtonDisplayName(button, display, mergeDisplay){
if(mergeDisplay){
display = Object.assign({}, this.getDefaultDiplay(), display);
} else {
@@ -163,7 +174,7 @@ class Utilities {
* @param {object} options The simple-keyboard options object
* @param {number} caretPos The cursor's current position
*/
getUpdatedInput = (button, input, options, caretPos) => {
getUpdatedInput(button, input, options, caretPos){
let output = input;
@@ -210,7 +221,7 @@ class Utilities {
* @param {number} length Represents by how many characters the input should be moved
* @param {boolean} minus Whether the cursor should be moved to the left or not.
*/
updateCaretPos = (length, minus) => {
updateCaretPos(length, minus){
if(minus){
if(this.simpleKeyboardInstance.caretPosition > 0)
this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition - length
@@ -356,7 +367,7 @@ class Utilities {
/**
* Gets the current value of maxLengthReached
*/
isMaxLengthReached = () => {
isMaxLengthReached(){
return Boolean(this.maxLengthReached);
}
@@ -365,7 +376,7 @@ class Utilities {
*
* @param {string} string The string to transform.
*/
camelCase = (string) => {
camelCase(string){
return string.toLowerCase().trim().split(/[.\-_\s]/g).reduce((string, word) => string + word[0].toUpperCase() + word.slice(1));
};
@@ -375,7 +386,7 @@ class Utilities {
* @param {Array} array The haystack to search in
* @param {string} value The needle to search for
*/
countInArray = (array, value) => {
countInArray(array, value){
return array.reduce((n, x) => n + (x === value), 0);
}