postgres-interval 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -11,6 +11,7 @@ declare namespace PostgresInterval {
11
11
  toPostgres(): string;
12
12
 
13
13
  toISO(): string;
14
+ toISOString(): string;
14
15
  }
15
16
  }
16
17
 
package/index.js CHANGED
@@ -46,7 +46,7 @@ var propertiesISOEquivalent = {
46
46
  var dateProperties = ['years', 'months', 'days']
47
47
  var timeProperties = ['hours', 'minutes', 'seconds']
48
48
  // according to ISO 8601
49
- PostgresInterval.prototype.toISO = function () {
49
+ PostgresInterval.prototype.toISOString = PostgresInterval.prototype.toISO = function () {
50
50
  var datePart = dateProperties
51
51
  .map(buildProperty, this)
52
52
  .join('')
@@ -68,18 +68,17 @@ PostgresInterval.prototype.toISO = function () {
68
68
 
69
69
  return value + propertiesISOEquivalent[property]
70
70
  }
71
-
72
71
  }
73
72
 
74
73
  var NUMBER = '([+-]?\\d+)'
75
74
  var YEAR = NUMBER + '\\s+years?'
76
75
  var MONTH = NUMBER + '\\s+mons?'
77
76
  var DAY = NUMBER + '\\s+days?'
78
- var TIME = '([+-])?([\\d]*):(\\d\\d):(\\d\\d)\.?(\\d{1,6})?'
77
+ var TIME = '([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?'
79
78
  var INTERVAL = new RegExp([YEAR, MONTH, DAY, TIME].map(function (regexString) {
80
79
  return '(' + regexString + ')?'
81
80
  })
82
- .join('\\s*'))
81
+ .join('\\s*'))
83
82
 
84
83
  // Positions of values in regex match
85
84
  var positions = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "postgres-interval",
3
3
  "main": "index.js",
4
- "version": "1.1.2",
4
+ "version": "1.2.0",
5
5
  "description": "Parse Postgres interval columns",
6
6
  "license": "MIT",
7
7
  "repository": "bendrucker/postgres-interval",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "tape": "^4.0.0",
29
- "standard": "^4.0.0"
29
+ "standard": "^12.0.1"
30
30
  },
31
31
  "files": [
32
32
  "index.js",
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # postgres-interval [![Build Status](https://travis-ci.org/bendrucker/postgres-interval.svg?branch=master)](https://travis-ci.org/bendrucker/postgres-interval)
1
+ # postgres-interval [![Build Status](https://travis-ci.org/bendrucker/postgres-interval.svg?branch=master)](https://travis-ci.org/bendrucker/postgres-interval) [![Greenkeeper badge](https://badges.greenkeeper.io/bendrucker/postgres-interval.svg)](https://greenkeeper.io/)
2
2
 
3
3
  > Parse Postgres interval columns
4
4
 
@@ -37,10 +37,12 @@ A Postgres interval string.
37
37
 
38
38
  Returns an interval string. This allows the interval object to be passed into prepared statements.
39
39
 
40
- #### `interval.toISO()` -> `string`
40
+ #### `interval.toISOString()` -> `string`
41
41
 
42
42
  Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string.
43
43
 
44
+ Also available as `interval.toISO()` for backwards compatibility.
45
+
44
46
  ## License
45
47
 
46
48
  MIT © [Ben Drucker](http://bendrucker.me)