{"id":22208320,"url":"https://github.com/steenhansen/type-czech-always-on","last_synced_at":"2025-03-25T04:36:15.698Z","repository":{"id":149760026,"uuid":"494975119","full_name":"steenhansen/type-czech-always-on","owner":"steenhansen","description":"Highlight the use of the Type-Czech Javascript library for run-time type checking. Always on.","archived":false,"fork":false,"pushed_at":"2024-01-09T00:26:17.000Z","size":540,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-30T04:42:41.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://type-czech-always-on.onrender.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steenhansen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-22T06:11:26.000Z","updated_at":"2023-02-17T20:10:46.000Z","dependencies_parsed_at":"2024-12-02T19:17:49.704Z","dependency_job_id":"be306de9-1569-4312-ad99-6aa4fbf4457d","html_url":"https://github.com/steenhansen/type-czech-always-on","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steenhansen%2Ftype-czech-always-on","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steenhansen%2Ftype-czech-always-on/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steenhansen%2Ftype-czech-always-on/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steenhansen%2Ftype-czech-always-on/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steenhansen","download_url":"https://codeload.github.com/steenhansen/type-czech-always-on/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245401372,"owners_count":20609163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T19:17:37.555Z","updated_at":"2025-03-25T04:36:15.674Z","avatar_url":"https://github.com/steenhansen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"The Run-Time-Type-Checking-Example web page, [https://type-czech-always-on.onrender.com/](https://type-czech-always-on.onrender.com/) a free slow to start [vite-plugin-ssr](https://vite-plugin-ssr.com/) project, exists to highlight the use of the\n[Type-Czech Javascript library](https://github.com/steenhansen/type-czech)\nwhich provides run time type checking in Node.js and the browser. Note slow start up time as on free Heroku dyno. It finds the square roots of differing types of numbers with a type checked Javascript async fetch call.\n\n![Roman 38 is square root of 1444](pages/screen-shot.png)\n\nThere is only one function that is type checked in this program, async serverGetSqrt(), which fetches a\nsquare root from the server. Both parameters and results are inspected for\ncorrectness when Type-Czech is turned on. When Type-Czech is turned off, then there is no discernible effect.\n\nThe code to link-up the async serverGetSqrt() function to the type checking functions is:\n\n`serverGetSqrt = type_czech.linkUp(serverGetSqrt, PRE_serverGetSqrt, POST_serverGetSqrt); `\n\n`async function serverGetSqrt(number_style, to_square_root) { ... }`\n\nWhere PRE_serverGetSqrt() is the function that checks parameters before the actual serverGetSqrt() function is called. While the POST_serverGetSqrt() function executes after the actual function is called to\nanalyze the returned result value for any issues.\n\nThe two PRE and POST type-checking functions reside in [/Type-Czech/type-checks_HAS-CZECH.js](/Type-Czech/type-checks_HAS-CZECH.js).\n\n## TypeCzech is Not Installed, Just Dumped into a Folder\n\nTo easily be able to turn on and off type checking from the client browser via the \u003cb\u003eRun Time Type Checking Off\u003c/b\u003e radio button, the library just sits the Type-Czech folder, no npm install.\n\n\n\n## PRE_serverGetSqrt()\n\nChecks that the parameters for serverGetSqrt(), number_style and to_square_root\n\n- are two strings, no more, no less\n- the first parameter, number_style, must be one of Word/Roman/Float/Integer\n- the second paramter, to_square_root, must be\n  - a word like 'nine hundred sixtyone' if the type of number is 'Word'\n  - a Roman numeral like 'MCDXLIV' if the type of number is 'Roman'\n  - a float like '1.2' if the type of number is 'Float'\n  - an integer like '-2' if the type of number is 'Integer'\n\n## POST_serverGetSqrt()\n\n- checks that the server actually responds with a value to the fetch() call within 3 seconds\n- verifies that the type of number returned is the same, for example the square root of 'four' is 'two'\n- console.logs error messages like \"Error -'xyz' is not a valid roman number\"\n\n## Install\n\n- npm install\n\n## Running program\n\n- Localhost Dev, with Type-Czech on\n  - npm run dev-has-czech\n\n\u003cbr/\u003e\n\n- Localhost Dev, with Type-Czech off\n  - npm run dev-without-czech\n\n\u003cbr/\u003e\n\n- Localhost Prod, with Type-Czech on\n  - npm run prod-has-czech\n  - http://localhost:3000/\n\n\u003cbr/\u003e\n\n- Localhost Prod, with Type-Czech off\n  - npm run prod-without-czech\n  - http://localhost:3000/\n\n\n## Free Hosting on render.com\n\tWeb Service\n\t\n\tSettings\n\t\tBuild Command\t$ yarn\n\t\tStart Command\t$ yarn start","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteenhansen%2Ftype-czech-always-on","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteenhansen%2Ftype-czech-always-on","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteenhansen%2Ftype-czech-always-on/lists"}