npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mcode-data

v0.5.5

Published

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.

Downloads

171

Readme

MicroCODE's 'mcode-data' package

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

Description

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

Dependencies

  • Production
  1. None
  • Development
  1. Node.JS - standard runtime environment
  2. JSDocs - our preferred JavaScript documentation system
  3. Jest.JS - our preferred JavaScript testing framework

Development

When building a large application its important that the entire team agreed to common data handling practices.

Installing

  • 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

Testing

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

Included Functions

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') |

Documentation

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:

  1. Inline documentation for the coder.
  2. Intellisense popup documentation for the coder for every function.
  3. 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

Help

Contact Timothy McGuire, [email protected].

Terminology

| 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. |

Authors

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.

Version History

  • 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.

Future Development

  • 0.1.*
    • Any additional core code we will develop for general list processing work.
    • Complex function execution with passed arguments or passed functions.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

MicroCODE Mantra

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..