1.0.8 • Published 6 years ago

nano-metric v1.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

nano-metric

A cli/module for suzuki-yuki/metric-time

Getting Started

d-values, such as kdd and cdd are values (i.e. numbers) whereas values, such as kd and cd are identifiers.

This is how we roll:

Installing

$ npm i [-g] nano-metric -g just for using cli

Usage

Cli

$ [npx] nano-metric [date]|[kdd cdd]

If no date is supplied, the metric time now is printed (forward conversion or simple conversion).

If kdd and cdd values are supplied, the iso time of these values is printed (backwards conversion).

Module

const time = require('nano-metric');

while(true) {
  metric = time(new Date());
  process.stdout.write(metric.kd + ' kd ' + metric.cd + ' cd\r');
}

Should give you the output of https://suzuki-yuki.github.io/metric-time.

API

self(date)

Returns an object (nano-metric-object) of the structure:

{
  kd: kdd,
  cd: cdd
}

where kdd is the time in kilodays and cdd is the time in centidays.

self(kdd, cdd)

Takes kdd and cdd values as input and returns a Date()-object from kdd and cdd values.

self({kd: kdd, cd: cdd})

Order of kd: kdd and cd: cdd does NOT matter. Takes an nano-metric-object as input and returns a Date()-object from nano-metric-object. Better usability and preferred over self({kdd, cdd}).

self({kdd, cdd})

Order of kdd and cdd DOES matter. Takes an sorted objected as input and returns a Date()-object from sorted object.

Tests

$ npm run test

Built With

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago