
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
mcode-data
Advanced tools
Our Data Handling functions. These support type checking and type coercion and conversion of Objects--ints, string, number, JSON, any--to commonize data handling and type checking.
A public NPM Package of our internal data processing tools for Frontend and Backend JavaScript NodeJS projects.
This is an extremely 'light weight' package with zero dependencies.
Identical data and math handling on both...
This is our own internal data processing (data) code. It is used to gain more control over JavaScript data types and type coercion. Building large, extensible applications it is inevitable that you will have to carefully control data type coercion and handle type checking in a very common/consistent manner. Both of these can be defined as 'data handling', and this is our library for that in all our apps.
> node examples
When building a large application its important that the entire team agreed to common data handling practices.
npm install mcode-data
This package includes a simple demo module: examples.js. Running it directly will show you a set of examples for using all the data library functions.
node .\node_modules\mcode-data\examples
...this will deomnstrate thru console logging various uses of the mcode-data functions.
npm install --save-dev jest
npm test
These are the functions we want at the ready in any module for development and debug.
| Function | Description | Usage |
|---|---|---|
| Properties | ||
| property | Creates a property .set, .get, .validate, and .onchange. | mcode.property(options) |
| contextProperty | Defines a getter/setter proxy to sync instance to context. | mcode.contextProperty(instance, property, contextPath) |
| getProperty | Safely resolves a nested property using an array of keys. | mcode.getProperty(source, pathArray) |
| setProperty | Assigns a nested property on the target object. | mcode.setProperty(target, pathArray, value) |
| Universal Export | ||
| classExport | Exports a class to the global or specified namespace. | mcode.classExport('Namespace', 'ClassName', factory) |
| Type Checking | ||
| isString | Checks the type of an Object for String. | mcode.isString('stringToTest') |
| isObject | Checks the type of an Object for Object. | mcode.isObject(objectName) |
| isArray | Checks the type of an Object for Array. | mcode.isArray(arrayName) |
| isFunction | Checks the type of an Object for Function. | mcode.isFunction(objectName) |
| isNumber | Checks the type of an Object for Number. | mcode.isNumber(102022 or numberName) |
| ifNumber | Checks the type of an Object for Number, returns default. | mcode.ifNumber(102022 or numberName, defaultValue) |
| isNaN | Checks the type of an Object for NaN. | mcode.isNaN(numberName) |
| isJson | Checks the type of an Object for JSON. | mcode.isJson('{'JSON text'}' or objectName) |
| isHtml | Checks the type of an Object for HTML. | mcode.isHtml('<'HTML text'>' or objectName) |
| isDate | Checks the type of an Object for DATE. | mcode.isDate(timestamp) |
| isTimeStamp | Checks the type of an Object for TIME STAMP. | mcode.isTimeStamp(timestamp) |
| default | Returns a default value if an 'item' is 'blank'. | mcode.default(value, default) |
| Utilities | ||
| sleep | Pauses execution for a specified duration in ms. | await mcode.sleep(500); |
| generateRandomId | Generates a random alpha-numeric ID of specified length. | mcode.generateRandomId('myobject') |
| encodeJson | Encodes a JSON object into a Base64 string. | mcode.encodeJson(jsonObject) |
| encodeAttr | Encodes a string for safe inclusion in HTML attributes. | mcode.encodeAttr('stringToEncode') |
| Type Conversions | ||
| octify | Converts a string into octal bytes for log. | mcode.octify(stringToExamine) |
| hexify | Converts a string into hexadecimal bytes for log. | mcode.hexify(stringToExamine) |
| extractId | Extracts the first alpha-numeric ID Field from a string. | mcode.extractId("EP_GPT13TZ1_20231115_0800.L5K") |
| fromSnakeCase | Creates a 'Title Case String' from a 'snake-case-string'. | mcode.fromSnakeCase("snake-case-string") |
| toSnakeCase | Creates a 'snake-case-string' from a 'Title Case String'. | mcode.toSnakeCase("Title Case String") |
| HTTP Support | ||
| HTTP_CODES | A STATIC list of common HTTP status codes and messages. | mcode.HTTP_CODES |
| isDomAvailable | Checks if the DOM APIs are available in the current environment. | mcode.isDomAvailable() |
| httpStatus | Converts a http status code into a message. | mcode.httpStatus(code) |
| httpSeverity | Converts a http status code into a log severity. | mcode.httpSeverity(code) |
| UUID Support | ||
| uuidDecode | Decodes a UUID string into a JSON object. | mcode.uuidDecode('LLLLLLLL-MMMM-vHHH-VSSS-CNNNNNNNNNNN') |
We believe in explicit code documentation, for other users, and for our 'future selves'.
JSDocs is a standardized system for documenting functions and data structures that produces three (3) primary outputs:
This entire project--like all our projects--is documented with JSDocs.
To install JSDocs use, get to a terminal session in the project folder...
npm install --save-dev jsdoc
jsdoc.json
jsdoc -c .jsdoc.json
...then open ./docs/index.html

Contact Timothy McGuire, support@mcode.com.
| Word or Acronym | Description/Definition |
|---|---|
| NPM | Node Package Manager, actually “Node PM”, “Node pkgmakeinst” a system to deploy, install, and maintain NodeJS Apps. (PM was a BASH utility). |
| NVM | Node Version Manager, a tool that supports changing NodeJS versions. |
| MERN | MongoDB, Express, React, Node JS. |
| MongoDB | A ‘NoSQL’ database designed for Cloud applications, also referred to as a ‘Document Store’. |
| Express | Express is not a database but rather an ‘extensible routing language’ for communication between a Client and a Server. |
| React | A Web UI development system, a JavaScript library developed by Facebook and made public—and Open Source—since 2013. |
| Node JS | A development stack that executes from a local file store—on a local Server—instead of from a network of servers. |
| JSDocs | A toolset to automatically generate API-style documentation from source code tagging. |
Contributor's names and contact info...
This project is licensed under the MIT License - see the LICENSE.md file for details
MicroCODE, Inc. was founded in 1987 as a controls engineering and software development company.
We specialize in manufacturing and quality control applications that must run 24x7x365 for years at a time.
Our slogan, distilled from over three decades of developing, testing, installing, and supporting 24x7x365 manufacturing applications, is..

FAQs
Our Data Handling functions. These support type checking and type coercion and conversion of Objects--ints, string, number, JSON, any--to commonize data handling and type checking.
The npm package mcode-data receives a total of 31 weekly downloads. As such, mcode-data popularity was classified as not popular.
We found that mcode-data demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.