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...
- Frontend - in the Browser UI
- Backend - in the Server MVC
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
- Production
- None
- Development
- Node.JS - standard runtime environment
- JSDocs - our preferred JavaScript documentation system
- Jest.JS - our preferred JavaScript testing framework
When building a large application its important that the entire team agreed to common data handling practices.
- Get to a terminal session in the local repo folder of your project.
- Use 'npm install' to load the package. It can be used 'stand-alone'...
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.
- From your project directory after installation...
node .\node_modules\mcode-data\examples
...this will deomnstrate thru console logging various uses of the mcode-data functions.
- To test with JEST:
- From the mcode-data package directory...
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 |
---|---|---|
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) |
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) |
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) |
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-numberic 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 | ||
httpStatus | Converts a http status code into a message. | mcode.httpStatus(code) |
UUID Support | ||
uuidDecode | Decodes a UUID string into a JSON object. | mcode.uuidDecode('LLLLLLLL-MMMM-vHHH-VSSS-CNNNNNNNNNNN') |
We believe is 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:
- Inline documentation for the coder.
- Intellisense popup documentation for the coder for every function.
- External 'reference manual' documentation for your entire code base, if used consistently.
-
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
- Configure JSDoc processing in...
jsdoc.json
- To regenerate the JSDocs from all source code, use the following command (from the project root directory)...
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...
- Timothy McGuire @TimothyMcGuire - Founder, President-CEO of MicroCODE, Inc. a software and controls engineering company in Detroit, Michigan USA.
- 0.5.5
- Minor reformatting of the 'httpStatus()' message to [BRACKET] the subsystem producing the message.
- 0.5.4
- Corrected 'uuidDecode()' removed cnsole.log debug statement.
- 0.5.3
- Corrected 'uuidDecode()' handling of timestamps in UUIDv6 and UUIDv7.
- 0.5.2
- Added 'uuidDecode()' to display an immediate decoding of a UUID thru a JSON Object.
- 0.5.1
- Added 'httpStatus()' for use in mcode.resx() - see mcode-log package.
- 0.5.0
- All 'mcode-*' packages updated with 'ready()' only implemented in 'mcode-log'.
- 0.4.3
- Corrected 'isJson()' to required the 1st character be a '{', not any character.
- 0.4.2
- Added 'fromSnakeCase()' and 'toSnakeCase()'.
- 0.4.1
- Removed accidental dependency upon mcode-log.
- 0.4.0
- Synchronized mcode-data, mcode-log, mcode-list, mcode-package.
- 0.3.9
- Reorganization, all 'is' functions first.
- 0.3.8
- Initial version, moved all data handling functions into new mcode-data package from mcode-log.
- 0.0.0
- Initial movement of our data handling functions from mcode-log to mcode-data.
- 0.1.*
- Any additional core code we will develop for general list processing work.
- Complex function execution with passed arguments or passed functions.
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..