type-registry
A simple container used to declare different kinds of Type.
What?
Yeah. This doesn't make much sense in isolation, it's part of a larger (soon to be released) project centering around typed objects.
Installation
Install via npm.
npm install type-registry
Usage
; const Uint32 = id: 1 // Unique id for this type, mandatory name: 'UInt32' // Unique name for this type, can be a string or symbol, mandatory. anythingElseYouWant: 'goes here'; const Float64 = id: 2 name: 'Float64'; const registry = ; registry; // falseregistry;registry; // true let added = false;registry; added === false; registry;added === true; registry === Uint32;registry === Uint32;registry === Float64; registryTUint32 === Uint32;registryTFloat64 === Float64; registryI1 === Uint32;registryI2 === Float64; registry; // falseregistry; // falseregistry; // true ; // false User.id = 456; registry.isValidType(User); // true console.log('Total number of items in the registry:', registry.size); for (const type of registry) { console;}
License
Published by codemix under a permissive MIT License, see LICENSE.md.