Skip to content

Commit

Permalink
resolved 2 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
77it committed Feb 28, 2024
1 parent 76626a8 commit 5d79fcb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
15 changes: 13 additions & 2 deletions src/engine/modules/modules_loader__resolve.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// BEWARE: to serve GitHub files you can activate also GitHub Pages, to serve files in this way:
// https://77it.github.io/financial-modeling/src/lib/result.js
//
// JS file served by GitHub Pages are accepted by Deno, Node.js and browsers.

export { modulesLoader_Resolve };

/**
Expand All @@ -21,12 +26,18 @@ function modulesLoader_Resolve (moduleUrl) {
} else // If moduleEngineURI is not a GitHub path, return the original URI
_ret.push(_cdnURI);

// loop return array: if some element is missing the ".js" extension from the url, add it
// loop return array: if some element is missing an extension from the url, add it
for (let i = 0; i < _ret.length; i++) {
if (_ret[i].slice(-3).toLowerCase() !== '.js')
const ext = _ret[i].slice(-3).toLowerCase();
if (ext !== '.js' && ext !== '.mjs' && ext !== '.cjs' && ext !== '.ts')
_ret[i] = `${_ret[i]}.js`;
}

// MAYBE_TODO: in the future we can eventually:
// * shuffle the array to balance the load on the various CDN
// * add more CDN to the list
// * duplicate the CDN entries to try the CDN more than once

return _ret;

//#region local functions
Expand Down
13 changes: 8 additions & 5 deletions src/main-treasury-temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,21 @@ import * as CFG from './config/engine.js';
const args = (typeof Deno !== "undefined") ? Deno.args : process.argv.slice(2);
// check if array is an array, and then if the length is > 0
if (Array.isArray(args) && args.length > 0) {
/** @type {"string"} */
const str_txt = 'string'; // const that contains the string 'string', to prevent type error in Deno 1.40.5

const options = {
input: { type: 'string', short: 'i', default: '' },
output: { type: 'string', short: 'o', default: '' },
error: { type: 'string', short: 'e', default: ''},
input: { type: str_txt, short: 'i', default: '' },
output: { type: str_txt, short: 'o', default: '' },
errors: { type: str_txt, short: 'e', default: ''},
};

/** @type {{values: {input: string | undefined, output: string | undefined, errors: string | undefined}, positionals: any}} */
const args_parsed = (() => {
try {
//@ts-ignore
return parseArgs({args, options});
} catch (e) {
return {values: {}, positionals: []};
return {values: {input: undefined, output: undefined, errors: undefined}, positionals: []};
}
})();

Expand Down
4 changes: 3 additions & 1 deletion vendor/financial/_info.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from https://cdn.jsdelivr.net/npm/financial@0.1.3/ + added `//@ts-nocheck` to the file
from https://cdn.jsdelivr.net/npm/financial@0.1.3/dist/financial.esm.js + added `//@ts-nocheck` to the file
github home: https://github.com/lmammino/financial
npm: https://www.npmjs.com/package/financial

0 comments on commit 5d79fcb

Please sign in to comment.