0.0.9 • Published 6 years ago

quick.time v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

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'] }
0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

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

0.0.1

6 years ago