You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 7, 2018. It is now read-only.
Converting to and from CSS time
is really not difficult.
But this library
saves you the bother
of making sure
you get it right
and is well-supported
by unit tests.
It's one less thing
to worry about,
right? :)
If you're into
other package managers,
it is also available
from Bower, Component and Jam.
How do I use it?
Loading the library
If you are running in
Node.js,
Browserify
or another CommonJS-style
environment,
you can require
check-types like so:
varcheck=require('css-time');
It also the supports
the AMD-style format
preferred by Require.js.
If you are
including css-time.js
with an HTML <script> tag,
or neither of the above environments
are detected,
it will export the interface globally as cssTime.
Calling the exported functions
Two functions are exported, from and to.
from (string)
Returns the number of milliseconds
represented by a CSS time string.
If the argument
can't be parsed
as a CSS time,
an error is thrown.
The code
is all written in
ES3 syntax,
so works in any browser.
How do I set up the build environment?
Dependencies
The build environment relies on
Node.js,
NPM,
JSHint,
Mocha,
Chai and
UglifyJS.
Assuming that you already have Node.js and NPM set up,
you just need to run npm install to
install all of the dependencies as listed in package.json.
The unit tests are in test/css-time.js.
You can run them with the command npm test.
To run the tests in a browser,
open test/css-time.html.