diff --git a/docs/HockeyGame.html b/docs/HockeyGame.html new file mode 100644 index 0000000..b41493f --- /dev/null +++ b/docs/HockeyGame.html @@ -0,0 +1,208 @@ + + + + HockeyGame - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ class HockeyGame +
+
+ + + + + + + +
+
+
+
+
+ Constructors +
+
+ + +
🔗
+
+ +
+ + + HockeyGame + () + + + +
+ +
+
+
+ Methods +
+
+ + +
🔗
+
+ +
+ + + awayTeamScores + (): void + + + +
+

Call this method when away team scores. It will +increase home team score by 1 point.

+
+
+ + +
🔗
+
+ +
+ + + homeTeamScores + (): void + + + +
+

Call this method when home team scores. It will +increase home team score by 1 point.

+
+
+ + +
🔗
+
+ +
+ + + winner + () + + + +
+

Returns winner of the game.

+
+
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/INFINITY.html b/docs/INFINITY.html new file mode 100644 index 0000000..e3c903a --- /dev/null +++ b/docs/INFINITY.html @@ -0,0 +1,128 @@ + + + + INFINITY - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ variable INFINITY +
+ +
+
+
+

In statistics, infinity is set to 30.

+
+ type +
+
+ + +
🔗
+
+ +
+ + + + 30 + + + +
+ +
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/average.html b/docs/average.html new file mode 100644 index 0000000..eb645fe --- /dev/null +++ b/docs/average.html @@ -0,0 +1,167 @@ + + + + average - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ function average +
+ +
+
+
+ + + + +
+ + + +
+
+

Computes the average of the list. If the list is empty, the +function returns NaN

+
+ Parameters +
+
+ + +
🔗
+
+ +
+ + + lst + + + + +
+ +
+
+
+ Return Type +
+ +
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/compound_index.html b/docs/compound_index.html new file mode 100644 index 0000000..fb6fcb5 --- /dev/null +++ b/docs/compound_index.html @@ -0,0 +1,90 @@ + + + + Index - https://example.com/foo/ba documentation + + + + + + + + +
+

https://example.com/foo/ba

+

APIs

+ + +

Modules

+ +
+ +
+

Index

+ + + +
+ + +
+

Module
books.js

+
+
+ +
+ + +
+

Module
hockey.js

+
+
+ +
+ + +
+

Module
stats.js

+
+
+ + + +
+ +
+
+ + + + + + diff --git a/docs/fuse.js b/docs/fuse.js new file mode 100644 index 0000000..a7eea4e --- /dev/null +++ b/docs/fuse.js @@ -0,0 +1,11 @@ +// deno-fmt-ignore-file +// deno-lint-ignore-file +/** + * Fuse.js v7.0.0 - Lightweight fuzzy-search (http://fusejs.io) + * + * Copyright (c) 2023 Kiro Risk (http://kiro.me) + * All Rights Reserved. Apache Software License 2.0 + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ +var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},n=t.getFn,i=void 0===n?$.getFn:n,o=t.fieldNormWeight,c=void 0===o?$.fieldNormWeight:o;r(this,e),this.norm=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=new Map,r=Math.pow(10,t);return{get:function(t){var i=t.match(F).length;if(n.has(i))return n.get(i);var o=1/Math.pow(i,.5*e),c=parseFloat(Math.round(o*r)/r);return n.set(i,c),c},clear:function(){n.clear()}}}(c,3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return o(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?$.getFn:r,o=n.fieldNormWeight,c=void 0===o?$.fieldNormWeight:o,a=new R({getFn:i,fieldNormWeight:c});return a.setKeys(e.map(A)),a.setSources(t),a.create(),a}function N(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,a=void 0===c?0:c,s=t.distance,u=void 0===s?$.distance:s,h=t.ignoreLocation,l=void 0===h?$.ignoreLocation:h,f=r/e.length;if(l)return f;var d=Math.abs(a-o);return u?f+d/u:d?1:f}var W=32;function T(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?$.location:i,c=r.distance,a=void 0===c?$.distance:c,s=r.threshold,u=void 0===s?$.threshold:s,h=r.findAllMatches,l=void 0===h?$.findAllMatches:h,f=r.minMatchCharLength,d=void 0===f?$.minMatchCharLength:f,v=r.includeMatches,g=void 0===v?$.includeMatches:v,y=r.ignoreLocation,p=void 0===y?$.ignoreLocation:y;if(t.length>W)throw new Error("Pattern length exceeds max of ".concat(W,"."));for(var m,k=t.length,M=e.length,b=Math.max(0,Math.min(o,M)),x=u,w=b,S=d>1||g,L=S?Array(M):[];(m=e.indexOf(t,w))>-1;){var _=N(t,{currentLocation:m,expectedLocation:b,distance:a,ignoreLocation:p});if(x=Math.min(_,x),w=m+k,S)for(var O=0;O=P;D-=1){var K=D-1,q=n[e.charAt(K)];if(S&&(L[K]=+!!q),z[D]=(z[D+1]<<1|1)&q,E&&(z[D]|=(j[D+1]|j[D])<<1|1|j[D+1]),z[D]&C&&(A=N(t,{errors:E,currentLocation:K,expectedLocation:b,distance:a,ignoreLocation:p}))<=x){if(x=A,(w=K)<=b)break;P=Math.max(1,2*b-w)}}if(N(t,{errors:E+1,currentLocation:b,expectedLocation:b,distance:a,ignoreLocation:p})>x)break;j=z}var B={isMatch:w>=0,score:Math.max(.001,A)};if(S){var J=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}(L,d);J.length?g&&(B.indices=J):B.isMatch=!1}return B}function z(e){for(var t={},n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,c=void 0===o?$.location:o,a=i.threshold,s=void 0===a?$.threshold:a,u=i.distance,h=void 0===u?$.distance:u,l=i.includeMatches,f=void 0===l?$.includeMatches:l,d=i.findAllMatches,v=void 0===d?$.findAllMatches:d,g=i.minMatchCharLength,y=void 0===g?$.minMatchCharLength:g,p=i.isCaseSensitive,m=void 0===p?$.isCaseSensitive:p,k=i.ignoreLocation,M=void 0===k?$.ignoreLocation:k;if(r(this,e),this.options={location:c,threshold:s,distance:h,includeMatches:f,findAllMatches:v,minMatchCharLength:y,isCaseSensitive:m,ignoreLocation:M},this.pattern=m?t:t.toLowerCase(),this.chunks=[],this.pattern.length){var b=function(e,t){n.chunks.push({pattern:e,alphabet:z(e),startIndex:t})},x=this.pattern.length;if(x>W){for(var w=0,S=x%W,L=x-S;w1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,a=void 0===c?$.location:c,s=o.threshold,u=void 0===s?$.threshold:s,h=o.distance,l=void 0===h?$.distance:h,f=o.includeMatches,d=void 0===f?$.includeMatches:f,v=o.findAllMatches,g=void 0===v?$.findAllMatches:v,y=o.minMatchCharLength,p=void 0===y?$.minMatchCharLength:y,m=o.isCaseSensitive,k=void 0===m?$.isCaseSensitive:m,M=o.ignoreLocation,b=void 0===M?$.ignoreLocation:M;return r(this,n),(i=t.call(this,e))._bitapSearch=new D(e,{location:a,threshold:u,distance:l,includeMatches:d,findAllMatches:g,minMatchCharLength:p,isCaseSensitive:k,ignoreLocation:b}),i}return o(n,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),n}(K),X=function(e){a(n,e);var t=l(n);function n(e){return r(this,n),t.call(this,e)}return o(n,[{key:"search",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),n}(K),Y=[B,X,U,V,H,G,J,Q],Z=Y.length,ee=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,te=new Set([Q.type,X.type]),ne=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isCaseSensitive,o=void 0===i?$.isCaseSensitive:i,c=n.includeMatches,a=void 0===c?$.includeMatches:c,s=n.minMatchCharLength,u=void 0===s?$.minMatchCharLength:s,h=n.ignoreLocation,l=void 0===h?$.ignoreLocation:h,f=n.findAllMatches,d=void 0===f?$.findAllMatches:f,v=n.location,g=void 0===v?$.location:v,y=n.threshold,p=void 0===y?$.threshold:y,m=n.distance,k=void 0===m?$.distance:m;r(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:a,minMatchCharLength:u,findAllMatches:d,ignoreLocation:l,location:g,threshold:p,distance:k},this.pattern=o?t:t.toLowerCase(),this.query=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(ee).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i2&&void 0!==arguments[2]?arguments[2]:{}).auto,r=void 0===n||n;return ue(e)||(e=he(e)),function e(n){var i=Object.keys(n),o=function(e){return!!e[ae]}(n);if(!o&&i.length>1&&!ue(n))return e(he(n));if(function(e){return!g(e)&&b(e)&&!ue(e)}(n)){var c=o?n[ae]:i[0],a=o?n[se]:n[c];if(!m(a))throw new Error(function(e){return"Invalid value for key ".concat(e)}(c));var s={keyId:C(c),pattern:a};return r&&(s.searcher=ie(a,t)),s}var u={children:[],operator:i[0]};return i.forEach((function(t){var r=n[t];g(r)&&r.forEach((function(t){u.children.push(e(t))}))})),u}(e)}function fe(e,t){var n=e.matches;t.matches=[],x(n)&&n.forEach((function(e){if(x(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function de(e,t){t.score=e.score}var ve=function(){function e(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;r(this,e),this.options=t(t({},$),i),this.options.useExtendedSearch,this._keyStore=new j(this.options.keys),this.setCollection(n,o)}return o(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof R))throw new Error("Incorrect 'index' type");this._myIndex=t||P(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}},{key:"add",value:function(e){x(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n1&&void 0!==arguments[1]?arguments[1]:{}).limit,n=void 0===t?-1:t,r=this.options,i=r.includeMatches,o=r.includeScore,c=r.shouldSort,a=r.sortFn,s=r.ignoreFieldNorm,u=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t){var n=t.ignoreFieldNorm,r=void 0===n?$.ignoreFieldNorm:n;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var n=e.key,i=e.norm,o=e.score,c=n?n.weight:null;t*=Math.pow(0===o&&c?Number.EPSILON:o,(c||1)*(r?1:i))})),e.score=t}))}(u,{ignoreFieldNorm:s}),c&&u.sort(a),k(n)&&n>-1&&(u=u.slice(0,n)),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?$.includeMatches:r,o=n.includeScore,c=void 0===o?$.includeScore:o,a=[];return i&&a.push(fe),c&&a.push(de),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return a.length&&a.forEach((function(t){t(e,r)})),r}))}(u,this._docs,{includeMatches:i,includeScore:o})}},{key:"_searchStringList",value:function(e){var t=ie(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(x(n)){var c=t.searchIn(n),a=c.isMatch,s=c.score,u=c.indices;a&&r.push({item:n,idx:i,matches:[{score:s,value:n,norm:o,indices:u}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=le(e,this.options),r=function e(n,r,i){if(!n.children){var o=n.keyId,c=n.searcher,a=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(r,o),searcher:c});return a&&a.length?[{idx:i,item:r,matches:a}]:[]}for(var s=[],u=0,h=n.children.length;u1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?$.getFn:n,i=t.fieldNormWeight,o=void 0===i?$.fieldNormWeight:i,c=e.keys,a=e.records,s=new R({getFn:r,fieldNormWeight:o});return s.setKeys(c),s.setIndexRecords(a),s},ve.config=$,function(){re.push.apply(re,arguments)}(ne),ve},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Fuse=t(); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..e7270e6 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,218 @@ + + + + Index - https://example.com/foo/ba documentation + + + + + + + + + + + +
+

Index

+ + + +
+ +
+

Classes

+ + + + + + + +
+
+
+ c +
+ + HockeyGame +
+
+ +
+
+ +
+

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ f +
+ + average +
+
+

Computes the average of the list. If the list is empty, the +function returns NaN

+
+
+
+
+ f +
+ + isValidIsbn +
+
+ +
+
+
+ f +
+ + isValidIsbn10 +
+
+ +
+
+
+ f +
+ + isValidIsbn13 +
+
+ +
+
+
+ f +
+ + std +
+
+

Computes the standard deviation of the list. If the list is empty, the +function returns NaN

+
+
+
+ +
+

Variables

+ + + + + + + +
+
+
+ v +
+ + INFINITY +
+
+

In statistics, infinity is set to 30.

+
+
+
+ +
+ +
+
+ + + + + + diff --git a/docs/isValidIsbn.html b/docs/isValidIsbn.html new file mode 100644 index 0000000..ef754e7 --- /dev/null +++ b/docs/isValidIsbn.html @@ -0,0 +1,165 @@ + + + + isValidIsbn - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ function isValidIsbn +
+ +
+
+
+ + + + +
+ + + +
+
+
+ Parameters +
+
+ + +
🔗
+
+ +
+ + + str + + + + +
+ +
+
+
+ Return Type +
+ +
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/isValidIsbn10.html b/docs/isValidIsbn10.html new file mode 100644 index 0000000..5fc3edf --- /dev/null +++ b/docs/isValidIsbn10.html @@ -0,0 +1,165 @@ + + + + isValidIsbn10 - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ function isValidIsbn10 +
+ +
+
+
+ + + + +
+ + + +
+
+
+ Parameters +
+
+ + +
🔗
+
+ +
+ + + str + + + + +
+ +
+
+
+ Return Type +
+ +
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/isValidIsbn13.html b/docs/isValidIsbn13.html new file mode 100644 index 0000000..21bcf10 --- /dev/null +++ b/docs/isValidIsbn13.html @@ -0,0 +1,165 @@ + + + + isValidIsbn13 - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ function isValidIsbn13 +
+ +
+
+
+ + + + +
+ + + +
+
+
+ Parameters +
+
+ + +
🔗
+
+ +
+ + + str + + + + +
+ +
+
+
+ Return Type +
+ +
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/search.js b/docs/search.js new file mode 100644 index 0000000..53a0938 --- /dev/null +++ b/docs/search.js @@ -0,0 +1,169 @@ +const Fuse = window.Fuse; + +const searchInput = document.querySelector("#searchbar"); +const mainContentTags = document.getElementsByTagName("main"); +const searchResultsDiv = document.querySelector("#searchResults"); +const currentSymbol = + document.querySelector("meta[name='doc-current-symbol']").attributes + .getNamedItem("content").value; +const pathToRoot = currentSymbol.split(".").slice(1).map(() => "../").join(""); +searchInput.removeAttribute("style"); + +const SEARCH_INDEX = window.DENO_DOC_SEARCH_INDEX; + +const fuse = new Fuse(SEARCH_INDEX.nodes, { + keys: [{ + name: "name", + weight: 2, + }, { + name: "nsQualifiers", + weight: 1, + }], + isCaseSensitive: false, + minMatchCharLength: 2, + threshold: 0.4, +}); + +const loadedUrl = new URL(window.location.href); +const val = loadedUrl.searchParams.get("q"); +if (val) { + searchInput.value = val; + doSearch(val); +} + +window.addEventListener("load", function () { + document.addEventListener("keydown", function (event) { + if (event.key.toLowerCase() === "s") { + if (event.target !== searchInput) { + searchInput.focus(); + event.preventDefault(); + } + } + }); + + const emptyPlaceholder = "Click or press 'S' to search..."; + searchInput.placeholder = emptyPlaceholder; + + searchInput.addEventListener("focus", function () { + searchInput.placeholder = "Type your query here..."; + }); + + searchInput.addEventListener("blur", function () { + searchInput.placeholder = emptyPlaceholder; + }); +}); + +function debounce(func, delay) { + let timerId; + + return function () { + const context = this; + const args = arguments; + + clearTimeout(timerId); + + timerId = setTimeout(function () { + func.apply(context, args); + }, delay); + }; +} + +const debouncedSearch = debounce(doSearch, 250); + +searchInput.addEventListener("input", (e) => { + const val = e.target.value; + debouncedSearch(val); +}); + +function doSearch(val) { + if (!val) { + updateCurrentLocation(val); + showPage(); + } else { + const results = searchInIndex(val); + // console.log("results", results); + updateCurrentLocation(val); + renderResults(results); + showSearchResults(); + } +} + +function updateCurrentLocation(val) { + const url = new URL(window.location.href); + if (val) { + url.searchParams.set("q", val); + } else { + url.searchParams.delete("q"); + } + window.history.replaceState({}, "", url.href); +} + +function showPage() { + for (const mainTag of mainContentTags) { + mainTag.style.display = "block"; + } + searchResultsDiv.style.display = "none"; +} + +function showSearchResults() { + for (const mainTag of mainContentTags) { + mainTag.style.display = "none"; + } + searchResultsDiv.style.display = "block"; +} + +function renderResults(results) { + if (results.length === 0) { + searchResultsDiv.innerHTML = `No result`; + return; + } + + let html = ``; + searchResultsDiv.innerHTML = html; +} + +function searchInIndex(val) { + return fuse.search(val).map((result) => result.item); +} + +function docNodeKindToStringVariants(kind) { + switch (kind) { + case "function": + return ["Function", "Function", "f"]; + case "variable": + return ["Variable", "Variable", "v"]; + case "class": + return ["Class", "Class", "c"]; + case "enum": + return ["Enum", "Enum", "E"]; + case "interface": + return ["Interface", "Interface", "I"]; + case "typeAlias": + return ["TypeAlias", "Type Alias", "T"]; + case "namespace": + return ["Namespace", "Namespace", "N"]; + default: + return []; + } +} diff --git a/docs/search_index.js b/docs/search_index.js new file mode 100644 index 0000000..a02c92f --- /dev/null +++ b/docs/search_index.js @@ -0,0 +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"}]}; +})() \ No newline at end of file diff --git a/docs/std.html b/docs/std.html new file mode 100644 index 0000000..59983ab --- /dev/null +++ b/docs/std.html @@ -0,0 +1,167 @@ + + + + std - https://example.com/foo/ba documentation + + + + + + + + + + + +
+ ← Back to index + + +
+ +
+
+
+
+ function std +
+ +
+
+
+ + + + +
+ + + +
+
+

Computes the standard deviation of the list. If the list is empty, the +function returns NaN

+
+ Parameters +
+
+ + +
🔗
+
+ +
+ + + lst + + + + +
+ +
+
+
+ Return Type +
+ +
+
+
+
+
+ +
+ + +
+
+ + + + + + diff --git a/docs/styles.css b/docs/styles.css new file mode 100644 index 0000000..9d3f50a --- /dev/null +++ b/docs/styles.css @@ -0,0 +1,475 @@ +:root { + font-family: sans-serif; + --general-border-radius: 10px; +} +body { + margin: 0; + background-color: rgb(231 229 228); + display: flex; +} +table { + border-color: inherit; + border-collapse: collapse; +} +#content { + padding: 30px; + width: 100%; + background-color: white; + border-radius: var(--general-border-radius) 0 0 var(--general-border-radius); + overflow-y: auto; +} +#content > h2 { + margin: 0; +} +p { + margin: 0; +} +a { + color: inherit; + text-decoration: inherit; +} +.link { + color: rgb(37 99 235); + transition-property: color; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 75ms; +} +.link:hover { + color: rgb(96 165 250); +} +#sidepanel { + flex-shrink: 0; + padding: 12px 0 12px 12px; + height: 100vh; + width: fit-content; + min-width: 12%; + max-width: 22%; + top: 0; + left: 0; + overflow-y: scroll; + position: sticky; + box-sizing: border-box; + overscroll-behavior-y: contain; + scrollbar-width: thin; +} +#sidepanel ul { + list-style: none; + padding-left: 16px; +} +#sidepanel li { + display: block; + margin: -2px 0; +} +#sidepanel a { + display: block; + padding: 8px 16px 8px 8px; + border-radius: var(--general-border-radius) 0 0 var(--general-border-radius); + position: relative; +} +#sidepanel a span { + display: block; + width: 100%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +#sidepanel a:hover, #sidepanel a .active { + background-color: white; +} +#sidepanel a:hover::before, #sidepanel a .active::before { + content: ""; + position: absolute; + + background-color: transparent; + top: calc(var(--general-border-radius) * -2); + right: 0; + height: calc(var(--general-border-radius) * 2); + width: var(--general-border-radius); + border-bottom-right-radius: var(--general-border-radius); + box-shadow: 0 var(--general-border-radius) 0 0 white; +} +#sidepanel a:hover::after, #sidepanel a .active::after { + content: ""; + position: absolute; + + background-color: transparent; + bottom: calc(var(--general-border-radius) * -2); + right: 0; + height: calc(var(--general-border-radius) * 2); + width: var(--general-border-radius); + border-top-right-radius: var(--general-border-radius); + box-shadow: 0 calc(var(--general-border-radius) * -1) 0 0 white; +} +#sidepanel .section_title { + display: flex; + align-items: center; + gap: 10px; + margin: 10px 20px 10px 0; +} +#sidepanel .section_title h3 { + margin: 0; + line-height: 1; +} + +#searchbar { + width: 100%; + padding: 0.575rem; + box-sizing: border-box; + border: none; + background-color: rgb(231 229 228); + border-radius: 10px; + font-size: 1rem; + margin: 1.5rem 0; +} +#searchResults ul { + list-style: none; + padding: 0; +} +#searchResults ul li { + display: block; +} +#searchResults ul a { + display: flex; + gap: 1rem; + align-items: center; + padding: 10px 12px; + justify-content: space-between; + line-height: 1; +} +#searchResults ul a div:first-child { + display: flex; + gap: 10px; + align-items: center; +} +#searchResults ul a div:last-child { + color: gray; + font-style: italic; +} + +#searchResults ul a:hover { + background-color: rgb(243 244 246); +} + +#searchResults ul > * + * { + border-top: 1px solid rgb(209 213 219); +} + +/* doc classes */ +.symbol_group > * + * { + margin-top: 3rem; + /* 48px */ +} +.symbol > * + * { + margin-top: 2rem; + /* 32px */ +} +.symbol_header { + display: flex; + justify-content: space-between; + align-items: flex-start; +} +.doc_block_items > * + * { + margin-top: 1.75rem; + /* 28px */ +} +.doc_block_title { + font-weight: 500; + background-color: unset !important; +} +.doc_block_title > * + * { + margin-top: 0.25rem; + /* 4px */ +} +.doc_block_title > *:first-child { + font-size: 1.25rem; + /* 20px */ + line-height: 1.75rem; + /* 28px */ +} +.doc_block_subtitle { + font-size: 0.875rem; /* 14px */ + line-height: 1rem; /* 16px */ +} +.doc_block_subtitle > * + * { + margin-top: 0.125rem; /* 2px */ +} +.doc_block_subtitle_text { + color: rgb(156 163 175); + font-style: italic; +} +.section_title { + font-size: 0.875rem; + /* 14px */ + line-height: 1.5rem; + /* 24px */ + font-weight: 500; + color: rgb(156 163 175); + padding-top: 0.25rem; + /* 4px */ + padding-bottom: 0.25rem; + /* 4px */ +} +.section { + margin-top: 0.5rem; + /* 8px */ +} +.section > * + * { + margin-top: 1.75rem; + /* 28px */ +} +.doc_item { + /* TODO: group */ + position: relative; +} +.doc_item:hover .anchor { + display: block; +} +.doc_entry { + display: flex; + justify-content: space-between; +} +.doc_entry_children { + display: flex; + align-items: center; + overflow-wrap: break-word; + gap: 0.5rem; + /* 8px */ +} +.function_overload_selectors > * + * { + margin-top: 0.5rem; /* 8px */ +} +.function_overload_label { + display: block; + padding: 1rem; /* 16px */ + border-radius: 0.5rem; /* 8px */ + border: 1px solid rgb(209 213 219); + cursor: pointer; +} +.function_overload_label:hover { + border-color: rgb(243 244 246); +} + +.symbol_section { + display: block; +} + +.symbol_section > tr { + display: block; +} + +.symbol_section_symbol { + display: block; + padding-top: 0.25rem; /* 4px */ + padding-bottom: 0.25rem; /* 4px */ + padding-right: 0.75rem; /* 12px */ + font-weight: 700; +} + +.symbol_section_symbol > div { + min-width: 13rem; + display: flex; + align-items: center; +} + +.symbol_section_symbol > div > * + * { + margin-left: 0.5rem; /* 8px */ +} + +.symbol_section_doc { + display: block; + padding-top: 0.25rem; /* 4px */ + padding-bottom: 0.25rem; /* 4px */ + font-size: 0.875rem; /* 14px */ + line-height: 1.25rem; /* 20px */ + color: rgb(107 114 128); +} + +@media (min-width: 1024px) { + .symbol_section { + display: table; + } + + .symbol_section > tr { + display: table-row; + } + + .symbol_section_symbol { + display: table-cell; + } + + .symbol_section_doc { + display: table-cell; + } +} + +.anchor { + float: left; + line-height: 1; + display: none; + color: rgb(75 85 99); + margin-left: -18px; + padding-right: 4px; +} +.anchor:hover { + display: block; +} +.kind_Function_text { + color: #056CF0; +} +.kind_Function_bg { + background-color: #026BEB1A; +} +.kind_Variable_text { + color: #7E57C0; +} +.kind_Variable_bg { + background-color: #7E57C01A; +} +.kind_Class_text { + color: #20B44B; +} +.kind_Class_bg { + background-color: #2FA8501A; +} +.kind_Enum_text { + color: #22ABB0; +} +.kind_Enum_bg { + background-color: #22ABB01A; +} +.kind_Interface_text { + color: #D2A064; +} +.kind_Interface_bg { + background-color: #D4A0681A; +} +.kind_TypeAlias_text { + color: #A4478C; +} +.kind_TypeAlias_bg { + background-color: #A4478C1A; +} +.kind_Namespace_text { + color: #D25646; +} +.kind_Namespace_bg { + background-color: #D256461A; +} + +.symbol_kind { + border-radius: 50%; + width: 1.5rem; /* 24px */ + height: 1.5rem; /* 24px */ + display: inline-flex; + align-items: center; + justify-content: center; + font-weight: 500; + font-size: 0.75rem; /* 12px */ + line-height: 1; + flex-shrink: 0; + user-select: none; +} + +/* markdown */ +.markdown > * + * { + margin-top: 1rem; /* 16px */ +} + +.markdown :not(pre) > code { + /* TODO: font-mono */ + + font-size: 0.875rem; /* 14px */ + line-height: 1.25rem; /* 20px */ + padding: 0.25rem 0.375rem; /* 4px 6px */ + border-radius: 0.25rem; /* 4px */ + background-color: rgb(243 244 246); +} + +.markdown pre { + /* TODO: font-mono */ + + font-size: 0.875rem; /* 14px */ + line-height: 1.25rem; /* 20px */ + padding: 0.625rem; /* 10px */ + border-radius: 0.5rem; /* 8px */ + color: black; + background-color: rgb(243 244 246); + overflow-x: auto; +} + +.markdown a { + color: rgb(37 99 235); + transition-property: color; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 75ms; +} +.markdown a:hover { + color: rgb(96 165 250); +} + +.markdown p { + margin: 0.25rem 0; /* 4px */ + text-align: left; +} + +.markdown table { + table-layout: auto; +} + +.markdown td { + padding: 0.5rem; /* 8px */ + border: 1px solid rgb(107 114 128); +} + +.markdown th { + font-weight: 700; + text-align: center; +} + +.markdown_summary { + display: inline; + color: rgb(75 85 99); +} + +.markdown_summary p { + display: inline-block; +} + +.markdown_summary a { + color: rgb(37 99 235); + transition-property: color; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 75ms; +} +.markdown_summary a:hover { + color: rgb(96 165 250); +} +.markdown_summary :not(pre) > code { + /* TODO: font-mono */ + + font-size: 0.875rem; /* 14px */ + line-height: 1.25rem; /* 20px */ + padding: 0.125rem 0.25rem; /* 2px 4px */ + border-radius: 0.25rem; /* 4px */ + background-color: rgb(243 244 246); +} + +.example > details .arrow_toggle { + color: rgb(75 85 99); +} +.example > details[open] .arrow_toggle { + transform: rotate(90deg); +} +.example > details > summary { + list-style: none; + display: flex; + align-items: center; + gap: 0.5rem; /* 8px */ + padding: 0.5rem 0.75rem; /* 8px 12px */ + border-radius: 0.5rem; /* 8px */ + width: 100%; + line-height: 1.5rem; /* 24px */ +} +.example > details > summary::-webkit-details-marker { + display: none; +} diff --git a/exo-recapitulatif/index.html b/exo-recapitulatif/index.html index 0545bb6..de1bbc1 100644 --- a/exo-recapitulatif/index.html +++ b/exo-recapitulatif/index.html @@ -1,6 +1,24 @@ - - + + + + + + title + - - - \ No newline at end of file + +
+ + +
+ +
+
+ +
+ +

+
+ + + \ No newline at end of file diff --git a/exo-recapitulatif/script.js b/exo-recapitulatif/script.js index 125bc46..85d4704 100644 --- a/exo-recapitulatif/script.js +++ b/exo-recapitulatif/script.js @@ -1,8 +1,12 @@ - +import {std as average} from "https://cdn.jsdelivr.net/gh/didiercrunch/cours-420-301-ah@main/modules-examples/stats.js"; +import {isValidIsbn} from "https://cdn.jsdelivr.net/gh/didiercrunch/cours-420-301-ah@main/modules-examples/books.js"; export function toto(){ + console.log(average([10, 15])); console.log("say toto"); } +alert(isValidIsbn("ddd")) + export function hello(){ console.log("say hello"); } diff --git a/modules-examples/hockey.js b/modules-examples/hockey.js new file mode 100644 index 0000000..d3f743f --- /dev/null +++ b/modules-examples/hockey.js @@ -0,0 +1,38 @@ +export class HockeyGame{ + constructor(){ + this.home = 0 + this.away = 0 + } + + /** + * Call this method when home team scores. It will + * increase home team score by 1 point. + */ + homeTeamScores(){ + this.home += 1; + } + + /** + * Call this method when away team scores. It will + * increase home team score by 1 point. + */ + awayTeamScores(){ + this.away += 1; + } + + /** + * Returns winner of the game. + * + * @returns {string} the name of the winner team. Either "home", "away" or "tie" + */ + winner(){ + if(this.home > this.away){ + return "home" + } + if(this.away > this.home){ + return "away" + } + return "tie" + } + +} diff --git a/modules-examples/stats.js b/modules-examples/stats.js index 8ceb4bd..9cf23e2 100644 --- a/modules-examples/stats.js +++ b/modules-examples/stats.js @@ -1,5 +1,15 @@ +/** + * In statistics, infinity is set to 30. + */ export const INFINITY = 30; + +/** + * Computes the average of the list. If the list is empty, the + * function returns NaN + * @param {number[]} lst + * @returns the average of the list. + */ export function average(lst){ if(lst.length < 1){ return NaN; @@ -14,6 +24,12 @@ export function average(lst){ } +/** + * Computes the standard deviation of the list. If the list is empty, the + * function returns NaN + * @param {number[]} lst + * @returns the standard deviation of the list. + */ export function std(lst){ if(lst.length < 1){ return NaN;