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

moment-duration-format

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-duration-format - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

bower.json
{
"name": "moment-duration-format",
"version": "1.2.1",
"version": "1.2.2",
"description": "A moment.js plugin for formatting durations.",

@@ -5,0 +5,0 @@ "main": "lib/moment-duration-format.js",

@@ -1,4 +0,4 @@

/*! Moment Duration Format v1.2.1
/*! Moment Duration Format v1.2.2
* https://github.com/jsmreese/moment-duration-format
* Date: 2014-04-24
* Date: 2014-07-10
*

@@ -70,3 +70,7 @@ * Duration format plugin function for the Moment.js library

// require lodash or underscore
_ = require('lodash') || require('underscore');
try {
_ = require('lodash');
} catch (e) {
_ = require('underscore');
}
} else if (root._) {

@@ -399,2 +403,2 @@ _ = root._;

})(this);
})(this);
{
"name": "moment-duration-format",
"version": "1.2.1",
"version": "1.2.2",
"description": "A moment.js plugin for formatting durations.",

@@ -5,0 +5,0 @@ "main": "lib/moment-duration-format.js",

@@ -30,12 +30,23 @@ #Moment Duration Format

The format function may be called with three optional arguments:
##### Module
To use this plugin as a module, use the `require` function:
```
moment.duration.format([template] [, precision] [, settings])
require("moment-duration-format");
```
Both the `template` and `precision` arguments may be specified as part of a single `settings` object argument if desired.
The plugin does not export anything, so there is no need to assign the require output to a variable.
Within the `template` string, moment-token characters will be replaced with the duration value for that type.
Moment-tokens maybe be customized (see test cases for examples), but the default token map is:
The plugin depends on moment.js and lodash.js or underscore.js. These are not specified as package dependencies in the currently published plugin version.
##### Arguments
The duration format method may be called with three optional arguments:
```
moment.duration.format([template] [, precision] [, settings])
```
`template` is a string. It is parsed for moment-token characters, which are replaced with the duration value for that type.
Moment-tokens may be be customized (see test cases for examples), but the default token map is:
```
years: Y or y

@@ -51,4 +62,8 @@ months: M

`precision` is an integer. Positive precision defines the number of decimal digits to display. Negative precision will truncate the value to the left of the decimal point.
Basic usage:
Both the `template` and `precision` arguments may be specified as properties of a single `settings` object argument if desired, or they may be passed separately along with an optional settings object.
##### Basics
```

@@ -87,2 +102,2 @@ moment.duration(123, "minutes").format();

See the test cases and the default options for more thorough option descriptions.
See the test cases and the default settings for more thorough option descriptions.
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