{"id":25497288,"url":"https://github.com/microcodeincorporated/mcode-list","last_synced_at":"2026-02-05T23:01:10.912Z","repository":{"id":220154644,"uuid":"750448798","full_name":"MicroCODEIncorporated/mcode-list","owner":"MicroCODEIncorporated","description":"Our List Processing functions. These support lists of Objects--numbers, string, JSON, any--that are ordered and related to other lists on the same topic. These can be used to swapped one item in a list with its corresponding element in a related list or used to execute code.","archived":false,"fork":false,"pushed_at":"2025-11-05T19:26:28.000Z","size":5840,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"production","last_synced_at":"2025-11-05T21:26:09.382Z","etag":null,"topics":["dictionary","javascript","lisp","lists"],"latest_commit_sha":null,"homepage":"https://www.mcode.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/MicroCODEIncorporated.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-30T17:03:33.000Z","updated_at":"2025-11-05T19:26:32.000Z","dependencies_parsed_at":"2024-01-31T16:32:42.904Z","dependency_job_id":"831eaeda-660e-490a-bf75-601d44cba552","html_url":"https://github.com/MicroCODEIncorporated/mcode-list","commit_stats":null,"previous_names":["microcodeincorporated/mcode-list"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MicroCODEIncorporated/mcode-list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroCODEIncorporated%2Fmcode-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroCODEIncorporated%2Fmcode-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroCODEIncorporated%2Fmcode-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroCODEIncorporated%2Fmcode-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MicroCODEIncorporated","download_url":"https://codeload.github.com/MicroCODEIncorporated/mcode-list/tar.gz/refs/heads/production","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroCODEIncorporated%2Fmcode-list/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29137750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T22:49:08.052Z","status":"ssl_error","status_checked_at":"2026-02-05T22:45:32.059Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dictionary","javascript","lisp","lists"],"created_at":"2025-02-19T01:19:02.025Z","updated_at":"2026-02-05T23:01:10.901Z","avatar_url":"https://github.com/MicroCODEIncorporated.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MicroCODE's 'mcode-list' package\r\n\r\nA public NPM Package of our internal list processing tools for Frontend and Backend JavaScript NodeJS projects.\r\n\r\nThis is an extremely 'light weight' package with _zero dependencies_ (other than our own logging package which has none).\r\n\r\nIdentical logging on both...\r\n\r\n- **Frontend** - in the Browser UI\r\n- **Backend** - in the Server MVC\r\n\r\n## Description\r\n\r\nThis is our own internal list processing (lisp) code. It is used to gain more flexibility than a standard 'Dictionary'.\r\nBuilding large, extensible applications it is inevitable that you will have to extend decision trees and data sets.\r\nBoth of these can be defined as 'lists', lists that--when paired togther--make decisions, select data, execute functions, perform\r\ntransforms, etc. Over time we have distilled this down to two (2) simple functions:\r\n\r\n- **mcode.swap()** - allows any 'list' to be used as 'keys' and any other list of the same size to be used as 'values'.\r\n- **mcode.call()** - allows any 'list' to be used as 'keys' to call a function in any other list of the same size.\r\n\r\n- To test, from the CLI in the package folder...\r\n\r\n```\r\n\u003e node examples\r\n```\r\n\r\n- Example of package use...\r\n\r\n\u003cp align=\"left\"\u003e\u003cimg src=\".\\.github\\images\\mcode-list-example-calls.png\" width=\"720\" title=\"List Calls...\"\u003e\u003c/p\u003e\r\n\r\n- Corresponding results (logged to console by our **mcode-log** functions)...\r\n\r\n\u003cp align=\"left\"\u003e\u003cimg src=\".\\.github\\images\\mcode-list-example-results.png\" width=\"720\" title=\"List Results...\"\u003e\u003c/p\u003e\r\n\r\n## Dependencies\r\n\r\n- **Production**\r\n\r\n1. mcode-log - our standard logging package (_just for displaying list mismatch errors or test results_)\r\n\r\n- **Development**\r\n\r\n1. Node.JS - standard runtime environment\r\n2. JSDocs - our preferred JavaScript documentation system\r\n3. Jest.JS - our preferred JavaScript testing framework\r\n\r\n## Development\r\n\r\nWhen using list processing it's best to start with a good definition of the lists of objects your App will deal with.\r\n\r\n**USE CASE #1**: Localization, or dynamic language switching. Where you can define lists for your UI to switch languages on-the-fly.\r\n\r\n1. The first list is a set of App defined tokens that identify a piece of text somewhere in the UI.\r\n2. The next list can be the English (EN) text list.\r\n3. The next list can be the Spanish (SP) text list.\r\n4. ...etc.\r\n\r\nThen at runtime, you call...\r\n\r\n1. uiToken = DOM Element ID\r\n2. uiLanguage = Currently configured language from 'Settings/Context'\r\n3. uiLanguageList = **mcode.swap**(uiLanguage, languages, languageLists);\r\n4. uiElementText = **mcode.swap**(uiToken, uiTokens, uiLanguageList);\r\n5. Place 'uiElementText' in the DOM Element.\r\n\r\n...this is over simplified but you get the idea. Using techiques like these we produced the first Plant-Floor\r\nmanufacturing application in General Motors that could literally toggle thru all supported languages as fast as you could hit\r\nthe 'switch languages' key, including switching the language being used in the App Log files.\r\n\r\nAdding a new language would involve:\r\n\r\n1. Add the Language ID to the list 'languages'.\r\n2. Add the languageList as a new list (probably external JSON item defined all 'uiTokens' in the new language).\r\n3. Add the selection of the language to the uiLanguage menu (another list keyed off of 'langugages' list).\r\n4. Add the new languageList to 'uiLanguages'.\r\n\r\nNOTE: **No code would need to be touched anywhere**.\r\n\r\n**USE CASE #2**: Move your code base to a data driven structure, one that is easily extended in the future without editing the code itself.\r\n\r\nFirst step, remove all embedded **if-then-else** and **switch-case** logic from your App and externalize the lists that drive Application decisions.\r\n\r\n- if-then-else\r\n\r\n```\r\n    if (key == key1)\r\n    {\r\n        value = value1;\r\n    }\r\n    else if (key == key2)\r\n    {\r\n        value = value2;\r\n    }\r\n    else if (key == key3)\r\n    {\r\n        value = value3;\r\n    }\r\n    ...\r\n```\r\n\r\n- switch-case\r\n\r\n```\r\n    switch key:\r\n    {\r\n        case key1:\r\n            value = value1;\r\n            break;\r\n        case key2:\r\n            value = value2;\r\n            break;\r\n        case key3:\r\n            value = value3;\r\n            break;\r\n     ...\r\n    }\r\n```\r\n\r\n- list-processing for key generated values\r\n\r\n```\r\n    keys: { key1, key2, key3 };\r\n    values: { value1, value2, value3 };\r\n    ...\r\n    value = mcode.swap(key, keys, values);\r\n\r\n```\r\n\r\n- list-processing for key generated function calls\r\n\r\n```\r\n    keys: { key1, key2, key3 };\r\n    functions: { func1, func2, func3 };\r\n    ...\r\n    value = mcode.call(key, keys, functions);\r\n\r\n```\r\n\r\n- list-processing with caller's key matching of partial keys (sub-strings)\r\n\r\n```\r\n    partialkeys: { part1, part2, part3 };\r\n    functions: { func1, func2, func3 };\r\n    ...\r\n    value = list.callif(key, partialkeys, values, (key, partialkey) =\u003e key.includes(partialkey));\r\n\r\n```\r\n\r\n- list-processing with mixed or swapped lists (reversibility)\r\n\r\n```\r\n    keys: { key1, key2, key3 };\r\n    values: { value1, value2, value3 };\r\n    ...\r\n    key = mcode.swap(value, values, keys);\r\n\r\n```\r\n\r\n- list-processing with caller's key matching of partial keys (sub-strings)\r\n\r\n```\r\n    partialkeys: { part1, part2, part3 };\r\n    values: { value1, value2, value3 };\r\n    ...\r\n    value = list.swapif(key, partialkeys, values, (key, partialkey) =\u003e key.includes(partialkey));\r\n\r\n```\r\n\r\nEasier, clearer, concise, and extensible, and the lists can be externalized as JSON data.\r\n\r\n### Installing\r\n\r\n- Get to a terminal session in the local repo folder of your project.\r\n- Use 'npm install' to load the package. It can be used 'stand-alone'...\r\n\r\n```\r\nnpm install mcode-list\r\n```\r\n\r\n### Testing\r\n\r\nThis package includes a simple demo module: **examples.js**.\r\nRunning it directly will show you a set of examples for using **swap()** and **call()**.\r\n\r\n- From your project directory after installation...\r\n\r\n```\r\nnode .\\node_modules\\mcode-list\\examples\r\n```\r\n\r\n...this will demonstrate thru console logging various uses of the mcode-list functions.\r\n\r\n- To test with **JEST**:\r\n- From the **mcode-list** package directory...\r\n\r\n```\r\nnpm install --save-dev jest\r\nnpm test\r\n```\r\n\r\n- A view of the JEST tests in the console...\r\n\r\n\u003cp align=\"left\"\u003e\u003cimg src=\".\\.github\\images\\mcode-list-jest.png\" width=\"720\" title=\"Jest Results...\"\u003e\u003c/p\u003e\r\n\r\n## Included Functions\r\n\r\nThese are the functions we want at the ready in any module for development and debug.\r\n\r\n| Function   | Description                                                                  | Usage                                                       |\r\n| ---------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------- |\r\n| **swap**   | Swaps a 'key' found in a key list with a matching 'value' in value list      | value = mcode.swap(key, keys, values, [args])               |\r\n| **swapif** | Supports a custom function to select a partion 'key' match                   | value = mcode.swapif(key, keys, values, function, [args])   |\r\n| **call**   | Calls a function in a 'functions' list based on a 'key' found in a keys list | result = mcode.call(key, keys, functions, [args])           |\r\n| **callif** | Supports a custom function to select a partion 'key' match                   | result = mcode.call(key, keys, functions, function, [args]) |\r\n\r\n### Documentation\r\n\r\nWe believe is explicit code documentation, for other users, and for our 'future selves'.\u003cbr\u003e\r\nJSDocs is a standardized system for documenting functions and data structures that produces three (3) primary outputs:\r\n\r\n1. Inline documentation for the coder.\r\n2. Intellisense popup documentation for the coder for every function.\r\n3. External 'reference manual' documentation for your entire code base, if used consistently.\r\n\r\n- This entire project--like all our projects--is documented with **JSDocs**.\r\n\r\n- To install JSDocs use, get to a terminal session in the project folder...\r\n\r\n```\r\nnpm install --save-dev jsdoc\r\n```\r\n\r\n- Configure JSDoc processing in...\r\n\r\n```\r\njsdoc.json\r\n```\r\n\r\n- To regenerate the JSDocs from all source code, use the following command (from the project root directory)...\r\n\r\n```\r\njsdoc -c .jsdoc.json\r\n```\r\n\r\n...then open ./docs/index.html\r\n\r\n\u003cp align=\"left\"\u003e\u003cimg src=\".\\.github\\images\\mcode-list-jsdocs.png\" width=\"720\" title=\"JSDocs...\"\u003e\u003c/p\u003e\r\n\r\n## Help\r\n\r\nContact Timothy McGuire, support@mcode.com.\r\n\r\n## Terminology\r\n\r\n| Word or Acronym | Description/Definition                                                                                                                       |\r\n| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |\r\n| **LISP**        | List Processing.                                                                                                                             |\r\n| **NPM**         | Node Package Manager, actually “Node PM”, “Node pkgmakeinst” a system to deploy, install, and maintain NodeJS Apps. (PM was a BASH utility). |\r\n| **NVM**         | Node Version Manager, a tool that supports changing NodeJS versions.                                                                         |\r\n| **MERN**        | MongoDB, Express, React, Node JS.                                                                                                            |\r\n| **MongoDB**     | A ‘NoSQL’ database designed for Cloud applications, also referred to as a ‘Document Store’.                                                  |\r\n| **Express**     | Express is _not_ a database but rather an ‘extensible routing language’ for communication between a Client and a Server.                     |\r\n| **React**       | A Web UI development system, a JavaScript library developed by Facebook and made public—and Open Source—since 2013.                          |\r\n| **Node JS**     | A development stack that executes from a local file store—on a local Server—instead of from a network of servers.                            |\r\n| **JSDocs**      | A toolset to automatically generate API-style documentation from source code tagging.                                                        |\r\n\r\n## Authors\r\n\r\nContributor's names and contact info...\r\n\r\n- Timothy McGuire [@TimothyMcGuire](https://twitter.com/TimothyMcGuire) - Founder, President-CEO of MicroCODE, Inc. a software and controls engineering company in Detroit, Michigan USA.\r\n\r\n## Version History\r\n\r\n- v0.6.2\r\n  - Updated to mcode-data v0.6.4 and mcode-log v0.8.0\r\n- v0.6.1\r\n  - Use \\_\u003cpackage\u003e naming convention for internal use of our own mcode.\u003cpackage\u003e within other packages.\r\n- v0.6.0\r\n  - Added more standardized JSDoc module headers for inclusion in end-product documentation.\r\n  - Updated to mcode-data v0.6.2 and mcode-log v0.6.9\r\n- v0.5.9\r\n  - Updated to mcode-data v0.5.9 and mcode-log v0.5.9\r\n- v0.5.8\r\n  - Updated to mcode-data v0.5.8 and mcode-log v0.5.8\r\n- v0.5.6\r\n  - Corrected cross-spawn v7.0.0 - 7.0.4; Severity: high; Regular Expression Denial of Service\r\n  - Sync'ed to mcode-log v0.5.7 and mcode-data v0.5.7\r\n- v0.5.5\r\n  - Updated to mcode-data 0.5.5 and mcode-log v0.5.5\r\n- v0.5.3\r\n  - Updated to mcode-data v0.5.1 and mcode-log v0.5.3\r\n- v0.5.2\r\n  - Added swapif() and callif() to extend key matching to a caller's custom function.\r\n- v0.5.1\r\n  - Added options parameter passing to Call() list processing.\r\n- v0.5.0\r\n  - All 'mcode-\\*' packages updated with 'ready()' only implemented in 'mcode-log'.\r\n- v0.4.0\r\n  - Synchronized mcode-data, mcode-log, mcode-list, mcode-package.\r\n- v0.3.8\r\n  - Moved all data handling functions into new mcode-data package.\r\n- v0.3.0\r\n  - Updated to use mcode-log() v3.0.0.\r\n  - Removed JEST from the NPM package, only needed for testing, instructions to install are included.\r\n- v0.2.6\r\n  - Upgrade 'mcode-log' to v0.2.6\r\n- v0.2.5\r\n  - Upgrade 'mcode-log' to v0.2.5\r\n- v0.2.4\r\n  - Upgrade 'mcode-log' to v0.2.4\r\n- v0.2.2\r\n  - Upgrade 'mcode-log' to v0.2.2\r\n- v0.2.1\r\n  - Upgrade 'mcode-log' to v0.2.1\r\n- v0.2.0\r\n  - Upgrade 'mcode-log' to v0.2.0, sync'ed package versions to v0.2.0\r\n- v0.1.5\r\n  - Upgrade 'mcode-log' to v0.1.18.\r\n- v0.1.4\r\n  - Upgrade 'mcode-log' to v0.1.17.\r\n- v0.1.3\r\n  - Upgrade 'mcode-log' to v0.1.16.\r\n- v0.1.2\r\n  - Upgrade 'mcode-log' to v0.1.15.\r\n- v0.1.1\r\n  - Improved README examples, corrected typos.\r\n- v0.1.0\r\n  - Changed export to the Univeral Module Defintion (UMD) pattern, and now throw exceptions on list mismatches.\r\n- v0.0.6 \\* v0.0.7\r\n  - Updated 'mcode-log' to v0.1.11, corrected 'mcode.log()' call to 'log()' with this module, and updated README.\r\n- v0.0.5\r\n  - Updated 'mcode-log' to v0.1.5 and updated README.\r\n- v0.0.4\r\n  - Updated README, uninstalled JSDocs and Jest for publishing.\r\n- v0.0.3\r\n  - Corrected JSDocs and Jest to DEV ONLY dependencies.\r\n- v0.0.2\r\n  - Added JSDocs, Jest and updated README.\r\n- v0.0.1\r\n  - Initial movement of our internal code into an NPM package for ease of use in other projects.\r\n\r\n## Future Development\r\n\r\n- v0.1.\\*\r\n  - Any additional core code we will develop for general list processing work.\r\n  - Complex function execution with passed arguments or passed functions.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE.md file for details\r\n\r\n## MicroCODE Mantra\r\n\r\nMicroCODE, Inc. was founded in 1987 as a controls engineering and software development company.\u003cbr\u003e\r\nWe specialize in manufacturing and quality control applications that must run 24x7x365 for years at a time.\r\n\r\nOur slogan, distilled from over three decades of developing, testing, installing, and supporting 24x7x365\r\nmanufacturing applications, is..\r\n\r\n\u003cp align=\"left\"\u003e\u003cimg src=\".\\.github\\images\\hail-caesar.png\" width=\"720\" title=\"Hail Caesar!\"\u003e\u003c/p\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrocodeincorporated%2Fmcode-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrocodeincorporated%2Fmcode-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrocodeincorporated%2Fmcode-list/lists"}