Class: Constamp

Constamp

A class that produces context stamp instances.


new Constamp(o)

constructor - Create an immutable stamp relating to various data, including the

  • D: execPath, cwd and pwd,
  • T: time and hrtime, and
  • W: type, user info, arch, hostname, totalmem and platform.
Parameters:
Name Type Description
o object

= { format: null } parameters

Properties
Name Type Argument Description
format string <nullable>

a dayjs-recognizeable template string

json string <nullable>

a valid json string to copy from

Source:

Members


<static> format

the default timestamp format

Default Value:
  • 'YYYY-MM-DD HH:mm ss.SSS'
Source:

arch

get arch - operating system cpu architecture

Source:
See:

cwd

get cwd - current working directory of the Node.js process

Source:
See:

execPath

get execPath - absolute pathname of the executable that started the Node.js process

Source:
See:

hostname

get hostname - system's host name

Source:
See:

hrtime

get hrtime - the timestamp high-resolution real time

Source:
See:

isCopy

get isCopy - was this instance copied from json?

Source:

platform

get platform - operating system platform as set during node.js compile time

Source:
See:

pwd

get pwd - current working directory of the shell

Source:
See:

time

get time - the timestamp UTC epoch time as dayjs

Source:
See:

timeString

get timeString - the formatted timestamp UTC epoch time

Source:
See:

totalmem

get totalmem - total system memory

Source:
See:

type

get type - operating system type

Source:
See:

user

get user - the logged-in user's name

Source:
See:

Methods


<static> D(a, b)

determine whether given arguments share dir locations

Parameters:
Name Type Description
a Constamp

The first Constamp to compare

b Constamp

The other Constamp to compare

Source:

<static> sameDirs()

Source:
See:

<static> sameTimes()

Source:
See:

<static> sameWhos()

Source:
See:

<static> T(a, b)

determine whether given arguments share epoch timestamps

Parameters:
Name Type Description
a Constamp

The first Constamp to compare

b Constamp

The other Constamp to compare

Source:

<static> W(a, b)

determine whether given arguments share user/platform

Parameters:
Name Type Description
a Constamp

The first Constamp to compare

b Constamp

The other Constamp to compare

Source:

sharesDWith(b)

sharesDWith - determine whether this instance has the same directories as another Constamp instance

Parameters:
Name Type Description
b Constamp

the other instance to compare with

Source:
Returns:

true IFF d hashes equal

Type
boolean

sharesTimeWith(b)

sharesTimeWith - determine whether this instance has the same epoch time as another Constamp instance

Parameters:
Name Type Description
b Constamp

the other instance to compare with

Source:
Returns:

true IFF timestamps equal

Type
boolean

sharesWWith(b)

sharesWWith - determine whether this instance has the same who as another Constamp instance

Parameters:
Name Type Description
b Constamp

the other instance to compare with

Source:
Returns:

true IFF w hashes equal

Type
boolean

toJson()

toJson - serialize as a JSON string containg the fields:

  • d: hash,
  • t: utc, and
  • w: hash.
Source:
Returns:

JSON

Type
string

toString()

toString - a hash string representation of instance

Source:
Returns:

hash hex

Type
string

valueOf()

valueOf - the timestamp UTC epoch time as number

Source:
See:
Returns:

UTC epoch ms

Type
number