Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

timestring

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timestring - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

package.json

@@ -10,3 +10,3 @@ {

],
"author" : "Mike Barrett <mike182uk@gmail.com>",
"author" : "Michael David Barrett <mike182uk@gmail.com>",
"repository" : {

@@ -17,3 +17,3 @@ "type": "git",

"main" : "timestring.js",
"version" : "1.0.1"
"version" : "1.0.2"
}

@@ -1,2 +0,2 @@

#timestring
#Timestring

@@ -14,3 +14,3 @@ Attempts to parse a human readable time string into a time based value.

In the example above `str` is just a plain old `String` object. A new method to the `String` objects prototype named `parseTime`. This method parses the string and returns a time based value.
In the example above `str` is just a plain old `String` object. A new method is added to the `String` objects prototype named `parseTime`. This method parses the string and returns a time based value.

@@ -48,3 +48,3 @@ **By default the returned time value will be in seconds.**

timestring will parse the following keywords into time values:
Timestring will parse the following keywords into time values:

@@ -129,3 +129,3 @@ 1. `s, sec, secs, second, seconds` - will parse to seconds

In the example of above `hoursPerDay` is being set to `1`. When the time string is being parsed, the return value is being specified as hours. Normally `1d` would parse to `24` hours (as by deafult there are 24 hours in a day) but because `hoursPerDay` has been set to `1`, `1d` will now only parse to `1` hour.
In the example above `hoursPerDay` is being set to `1`. When the time string is being parsed, the return value is being specified as hours. Normally `1d` would parse to `24` hours (as by deafult there are 24 hours in a day) but because `hoursPerDay` has been set to `1`, `1d` will now only parse to `1` hour.

@@ -162,3 +162,3 @@ This would be useful for specific application needs.

### Browser
###Browser

@@ -170,5 +170,5 @@ All you need to do to get timestring working in the browser is download / clone this repo and make sure you include the `timestring.js` script on your page:

```
### Node.js
###Node
Timestring is also node compatible. To install for a project, navigate to the projects root folder and in your terminal and type the following:
To install for a node application, navigate to the projects root folder and in your terminal type the following:

@@ -181,3 +181,3 @@ ```

In your node application you need to require the timestirng module:
In your node application you need to require the timestring module:

@@ -188,2 +188,2 @@ ```js

Once you have done this, you will beable to use timestring in node, the same way you do in the browser!
Once you have done this, you will be able to use timestring in your node application, the same way you do in the browser!
(function(){
"use strict";

@@ -86,6 +85,6 @@

if (groups !== null) {
for(var group in groups) {
var g = groups[group],
value = g.match(/[0-9]+/g)[0],
unit = g.match(/[a-z]+/g)[0];
for(var i = 0; i < groups.length; i++) {
var g = groups[i];
var value = g.match(/[0-9]+/g)[0];
var unit = g.match(/[a-z]+/g)[0];

@@ -100,3 +99,3 @@ totalSeconds += getSeconds(value, unit);

// add convenience method to string proto
// add convenience method to string prototype
String.prototype.parseTime = function (unit, settings) {

@@ -106,3 +105,3 @@ return (new Timestring(settings)).parse(this, unit);

// export Timestring object for either the browser or node.js
// export Timestring object for either the browser or node
if (typeof module !== 'undefined' && module.exports) {

@@ -109,0 +108,0 @@ module.exports = Timestring;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc