+
Parameters
@@ -139,7 +141,8 @@
-
+
a text we want to test if it is a real isbn
+
diff --git a/docs/search_index.js b/docs/search_index.js
index a02c92f..0e1e33d 100644
--- a/docs/search_index.js
+++ b/docs/search_index.js
@@ -1,3 +1,3 @@
(function () {
- window.DENO_DOC_SEARCH_INDEX = {"nodes":[{"kind":"function","name":"isValidIsbn13","nsQualifiers":"","location":{"filename":"books.js","line":1,"col":0},"declarationKind":"export"},{"kind":"function","name":"isValidIsbn10","nsQualifiers":"","location":{"filename":"books.js","line":22,"col":0},"declarationKind":"export"},{"kind":"function","name":"isValidIsbn","nsQualifiers":"","location":{"filename":"books.js","line":46,"col":0},"declarationKind":"export"},{"kind":"class","name":"HockeyGame","nsQualifiers":"","location":{"filename":"hockey.js","line":1,"col":0},"declarationKind":"export"},{"kind":"variable","name":"INFINITY","nsQualifiers":"","location":{"filename":"stats.js","line":5,"col":13},"declarationKind":"export"},{"kind":"function","name":"average","nsQualifiers":"","location":{"filename":"stats.js","line":13,"col":0},"declarationKind":"export"},{"kind":"function","name":"std","nsQualifiers":"","location":{"filename":"stats.js","line":33,"col":0},"declarationKind":"export"}]};
+ window.DENO_DOC_SEARCH_INDEX = {"nodes":[{"kind":"function","name":"isValidIsbn13","nsQualifiers":"","location":{"filename":"books.js","line":8,"col":0},"declarationKind":"export"},{"kind":"function","name":"isValidIsbn10","nsQualifiers":"","location":{"filename":"books.js","line":36,"col":0},"declarationKind":"export"},{"kind":"function","name":"isValidIsbn","nsQualifiers":"","location":{"filename":"books.js","line":65,"col":0},"declarationKind":"export"},{"kind":"class","name":"HockeyGame","nsQualifiers":"","location":{"filename":"hockey.js","line":6,"col":0},"declarationKind":"export"},{"kind":"variable","name":"INFINITY","nsQualifiers":"","location":{"filename":"stats.js","line":5,"col":13},"declarationKind":"export"},{"kind":"function","name":"average","nsQualifiers":"","location":{"filename":"stats.js","line":13,"col":0},"declarationKind":"export"},{"kind":"function","name":"std","nsQualifiers":"","location":{"filename":"stats.js","line":33,"col":0},"declarationKind":"export"}]};
})()
\ No newline at end of file
diff --git a/modules-examples/books.js b/modules-examples/books.js
index 5f57b67..6c30976 100644
--- a/modules-examples/books.js
+++ b/modules-examples/books.js
@@ -1,3 +1,10 @@
+
+/**
+ * Validate is the input string is a valid 13 digits ISBN as defined
+ * in https://en.wikipedia.org/wiki/ISBN
+ * @param {String} str a text we want to test if it is a real isbn
+ * @returns {boolean} true/false depending is str is a valid 13 digits ISBN
+ */
export function isValidIsbn13(str) {
let sum, digit, check, i;
@@ -19,6 +26,13 @@ export function isValidIsbn13(str) {
return (check.toString() === str[str.length - 1]);
}
+
+/**
+ * Validate is the input string is a valid 10 digits ISBN as defined
+ * in https://en.wikipedia.org/wiki/ISBN
+ * @param {String} str a text we want to test if it is a real isbn
+ * @returns {boolean} true/false depending is str is a valid 10 digits ISBN
+ */
export function isValidIsbn10(str) {
let sum, digit, weight, check, i;
@@ -43,6 +57,11 @@ export function isValidIsbn10(str) {
}
+/**
+ * Validate is the input string is a valid ISBN https://en.wikipedia.org/wiki/ISBN
+ * @param {String} str a text we want to test if it is a real isbn
+ * @returns {boolean} true/false depending is str is a valid isbn
+ */
export function isValidIsbn(str) {
return isValidIsbn13(str) || isValidIsbn10(str);
}
diff --git a/modules-examples/hockey.js b/modules-examples/hockey.js
index d3f743f..7b63591 100644
--- a/modules-examples/hockey.js
+++ b/modules-examples/hockey.js
@@ -1,3 +1,8 @@
+
+/**
+ * Represent a the scoring of a hockey game. The two teams
+ * playing are "home" and "away".
+ */
export class HockeyGame{
constructor(){
this.home = 0
@@ -34,5 +39,4 @@ export class HockeyGame{
}
return "tie"
}
-
}