0.1.0 • Published 7 years ago

@endeo/types v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

@endeo/types

Build Status Dependency Status npm version

Common types for values in @endeo/specials objects.

These are used when creating an "object spec" to encode a "special object" in a compressed format. They are specified as the 'type' in the enhancers object.

When endeo's enbyte encodes a "special object" it must test each key's value to determine which type it is so it knows how to encode it. Specify its exact type to skip that work.

See packages:

  1. endeo
  2. enbyte
  3. debyte

Install

npm install --save @endeo/types

Usage

var types = require('@endeo/types')

var enhancers = {
  key: {
    type: types.day
  }
}

// OR, when specials has the type
specials.addType('day', types.day)

var enhancers = {
  key: 'day'
}

Extra Types

There are two extra types available for optional use:

  1. day - A Date requires many bytes to encode because it has a lot of info. If you only want to store the year, month, and day (in month) then you may use this type and it'll encode it in four bytes instead.
  2. time - As mentioned above, a Date requires many bytes. If you only want the hours and minutes (24-hour style) then use this type to encode it in two bytes.

MIT License

0.1.0

7 years ago