quick.time

0.0.9 • Public • Published

Quick.time

This package allows user input to be turned into milliseconds.


Installation

npm i quick.time

Usage

const parseTime = require('quick.time');
let output = parseTime(<String>);
 
// Returns:
output = {
  time: 0, // Returns the total milliseconds
  unused: [] // Returns any unused items in the String
}

Examples

let input = 'In around 5 seconds from now';
let output = parseTime(input);
console.log(output);
// -> { time: 5000, unused: ['In', 'around', 'from', 'now'] }
let input = '1 hour and 7 seconds remaining, also add 30 seconds to that.';
let output = parseTime(input);
console.log(output);
// -> { time: 3637000, unused: ['and', 'remaining', 'also', 'add', 'to', that'] }
let input = '5seconds & 4s plus 1 second, with random text inbetween 10 seconds';
let output = parseTime(input);
console.log(output);
// -> { time: 20000, unused: ['&', 'plus', 'with', 'random', 'text', 'inbetween'] }
let input = '10 items, 7 seconds, 4 boxes, 9 minutes, 40 milliseconds, 90 blankets';
let output = parseTime(input);
console.log(output);
// -> { time: 547040, unused: ['items', 'boxes', 'blankets'] }

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i quick.time

      Weekly Downloads

      0

      Version

      0.0.9

      License

      MIT

      Unpacked Size

      5.29 kB

      Total Files

      6

      Last publish

      Collaborators

      • truexpixels