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

@code-o-mat/globals

v0.0.17

Published

Abstract Package to support CodeOMat series of apps.

Downloads

16

Readme

CodeOMat Globals:

Alpha: version 0.0.1x: March 3, 2018:

Release Notes:

Version 0.0.1 will be released to support the HistoryCache Component of the CodeOMat System. As future components are developed, future releases of this package will be releaded in tandem.

All CodeOMat packages will adhere to the same version numbers.

Common values and functions to support libraries in the CodeOMat system in the @code-o-mat namespace.

For the most part, this package is intended to be used as an abstract package... that is only by other CodeOMat packages.

All packages in the CodeOMat namespace are currently experimental. Please use with Caution. In the future, this library will become better documented.

About CodeOMat

CodeOMat is a Meta Programming library that intends to make coding more concise, simpler and easier to read and learn.

installation

    npm install @code-o-mat/globals

Globals Components:

Cache:

Cache is a data object used to store properties of the OMat type objects in CodeOMat. This is a wrapper for a plain JavaScript object. Its use here is to maintain compatibility with more advanced properties caches such as HistoryCache that may be used in some OMat types but which may not be needed for others.

Each OMat has a Cache located at oMat[PROPS], where PROPS is a symbol imported from this library at constants/values.

The API for Cache is similar to the API for Immutable Map, but does not access deeply nested properties.

instantiation:

    const cache = new Cache([some data object]);

get a value at key with a fallback defaultValue:

    cache.get(key, defaultValue);

set a value at key:

    cache.set(key, value);

get the entire underlying JavaScript data object:

    cache.data();

merge a new data object: ( shallow merge ): Items in the new data will override the existing data where keys match.

    cache.merge(newDataObject);

Constants:

A series of constant values that will be used throughout the CodeOMat system. These are often used to allow pseudo - private function and attribute behaviors.

types:

These are Symbol objects that are attached to all CodeOMat objects as both instance and static values. They are used to identify the objects for validations and testing.

The types are:

O_MAT, METHOD_O_MAT, ACCESSOR_O_MAT, CONNECTOR_O_MAT, CLASS_O_MAT

values:

A set of values used by this library.

  • NONE: used to avoid typical .js null values which may interfere with some desired accessor function.
  • PROPS: internal properties of CodeOMat classes.

methods:

There are Symbols that represent methods in some of the CodeOMat objects. They are used to enforce a common function naming convention for non public methods.

Assertions & validations:

Assertions are available for some basic javascript types and also for OMat types.

All use the basic assert function of assert.

    import { assert } from '@globals/assertions/base-assertions';

    assert(1 === 1, 'An assert message'); // nothing happens.
    assert(1 === 2, 'An assert message'); // throws new Error('An assert message');

js-types

Assertions for basic javascript types. All have a default error message that can be overridden with the an optional second parameter.

There is no separate set of validations for js-types as these are native to javascript.

OMat types

Assertions for basic javascript types. All have a default error message that can be overridden with the an optional second parameter.

All OMat type assertions will test instances and classes

  • isOMat: As OMat is an abstract type, will return true for any number of OMat types.

VALIDATIONS:

  • isMethodOMat: isMethodOMat(methodOMat)
  • isAccessorOMat: isAccessorOMat(methodOMat)
  • isConnectorOMat: isConnectorOMat(methodOMat)
  • isClassOMat: isClassOMat(methodOMat)
  • isCodeOMat: isCodeOMat(methodOMat)

ASSERTIONS:

  • assertIsMethodOMat: assertIsMethodOMat(methodOMat, "optional message")

  • assertIsMethodOMatOrNONE: assertIsMethodOMatOrNONE(methodOMat, "optional message")

  • assertIsAccessorOMat: assertIsAccessorOMat(methodOMat, "optional message")

  • assertIsAccessorOMatOrNONE: assertIsAccessorOMatOrNONE(methodOMat, "optional message")

  • assertIsConnectorOMat: assertIsConnectorOMat(methodOMat, "optional message")

  • assertIsConnectorOMatOrNONE: assertIsConnectorOMatOrNONE(methodOMat, "optional message")

  • assertIsClassOMatOrNONE: assertIsClassOMatorNONE(methodOMat, "optional message")

  • assertIsCodeOMat: assertIsCodeOMat(methodOMat, "optional message")

  • assertIsCodeOMatOrNONE: assertIsCodeOMatOrNONE(methodOMat, "optional message")