Permalink
Browse files

refactor(ontime): factor out regex for time representation

  • Loading branch information...
mycoboco committed Aug 17, 2016
1 parent bfffb92 commit 465ab4e87b7d745e7cffefe9e1523269bbb8d9d9
Showing with 15 additions and 6 deletions.
  1. +1 −5 index.js
  2. +13 −0 lib/fmt.js
  3. +1 −1 lib/nextime.js
View
@@ -7,11 +7,7 @@
var nextime = require('./lib/nextime')
var fmt = {
norm: /^(?:(?:(?:(?:(?:(\d{4})-)?(\d{1,2})-)?(\d{1,2})\D)?(\d{1,2}):)?(\d{1,2}):)?(\d{1,2})$/,
week: /^[a-z]+\s(\d{1,2}:\d{1,2}:\d{1,2})$/i
}
var fmt = require('./lib/fmt')
var idcnt = 0
View
@@ -0,0 +1,13 @@
/*
* regular expressions to recognize time representations
*/
'use strict'
module.exports = {
norm: /^(?:(?:(?:(?:(?:(\d{4})-)?(\d{1,2})-)?(\d{1,2})\D)?(\d{1,2}):)?(\d{1,2}):)?(\d{1,2})$/,
week: /^[a-z]+\s(\d{1,2}:\d{1,2}:\d{1,2})$/i
}
// end of fmt.js
View
@@ -5,7 +5,7 @@
'use strict'
var fmt = /^(?:(?:(?:(?:(?:(\d{4})-)?(\d{1,2})-)?(\d{1,2})\D)?(\d{1,2}):)?(\d{1,2}):)?(\d{1,2})$/
var fmt = require('./fmt').norm
module.exports = function (cycle, s, now, utc, last) {

0 comments on commit 465ab4e

Please sign in to comment.