is-timestamp

1.0.0 • Public • Published

is-timestamp

Checks if a value is a timestamp

Install

$ npm install is-timestamp

Usage

const isTimestamp = require('is-timestamp')
 
isTimestamp(new Date())
// => true
 
isTimestamp(1466421736923)
// => true
 
isTimestamp('1466421736923')
// => true
 
isTimestamp('1466421736923', true)
// => false (because strict mode on)
 
isTimestamp('foo')
// => false

Notes

This module works by default for both integers and strings. If you only want to use integers, use the strict mode:

isTimestamp('1466421736923', true)
// => false

License

MIT © François Chalifour

/is-timestamp/

    Package Sidebar

    Install

    npm i is-timestamp

    Weekly Downloads

    59

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • francoischalifour