Skip to content

Commit

Permalink
Maint: fix datatypes in JSdocs and refactor checks to remove the use …
Browse files Browse the repository at this point in the history
…of is-it-check library
  • Loading branch information
hepabolu committed Apr 6, 2024
1 parent eb6028f commit 525a855
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/dictionary.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class Dictionary {
/**
* Return a word from the list
*
* @param {integer} index
* @param {number} index
* @return {string} - the word at the index position
*/
word(index) {
return null;
return '';
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/lib/dictionaryEN.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* @module DictionaryEN
*/

import is from 'is-it-check';
import {Dictionary} from './dictionary.mjs';

// version info
const version = '4.0.0';
// const version = '4.0.0';

// the word list
const THE_WORDS = [
Expand Down Expand Up @@ -1310,11 +1309,11 @@ class DictionaryEN extends Dictionary {
/**
* Return a word from the list
*
* @param {integer} index
* @param {number} index
* @return {string} - the word at the index position
*/
word(index) {
if (is.undefined(index) || !is.number(index) ||
if (index === undefined || (typeof index !== 'number') ||
index < 0 || index > THE_WORDS.length
) {
throw new Error('Parameter "index" not valid');
Expand Down

0 comments on commit 525a855

Please sign in to comment.