2017-08-22 03:52:27 +00:00
|
|
|
'use strict'
|
|
|
|
|
2017-09-25 02:28:26 +00:00
|
|
|
const log = require('../log')('intval')
|
2017-10-23 16:58:37 +00:00
|
|
|
const storage = require('node-persist')
|
|
|
|
const fs = require('fs')
|
2017-09-25 02:28:26 +00:00
|
|
|
|
2017-08-28 12:49:47 +00:00
|
|
|
let Gpio
|
|
|
|
try {
|
2017-10-23 17:32:45 +00:00
|
|
|
Gpio = require('onoff').Gpio
|
2017-08-28 12:49:47 +00:00
|
|
|
} catch (e) {
|
2017-09-26 03:26:13 +00:00
|
|
|
log.warn('Failed including Gpio, using sim')
|
2017-08-28 12:49:47 +00:00
|
|
|
Gpio = require('../../lib/onoffsim').Gpio
|
|
|
|
}
|
|
|
|
|
2017-08-26 23:26:30 +00:00
|
|
|
|
2017-08-22 05:31:27 +00:00
|
|
|
const PINS = {
|
|
|
|
fwd : {
|
2017-09-19 19:06:34 +00:00
|
|
|
pin : 13,
|
2017-08-22 05:31:27 +00:00
|
|
|
dir : 'out'
|
|
|
|
},
|
|
|
|
bwd : {
|
2017-09-19 19:06:34 +00:00
|
|
|
pin : 19,
|
2017-08-22 05:31:27 +00:00
|
|
|
dir : 'out'
|
|
|
|
},
|
|
|
|
micro : {
|
2017-10-20 01:21:41 +00:00
|
|
|
pin : 5,
|
2017-08-22 05:31:27 +00:00
|
|
|
dir : 'in',
|
2017-09-19 19:06:34 +00:00
|
|
|
edge : 'both'
|
2017-08-22 05:31:27 +00:00
|
|
|
},
|
|
|
|
release : {
|
2017-10-20 01:21:41 +00:00
|
|
|
pin : 6,
|
2017-08-22 05:31:27 +00:00
|
|
|
dir : 'in',
|
|
|
|
edge : 'both'
|
|
|
|
}
|
|
|
|
}
|
2017-08-22 03:52:27 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
/** Object representing the intval3 features */
|
|
|
|
const intval = {}
|
2017-09-23 12:53:48 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
intval.init = function () {
|
2017-10-23 16:58:37 +00:00
|
|
|
if (!fs.existsSync('./state')) fs.mkdirSync('./state')
|
|
|
|
storage.init({
|
|
|
|
dir: './state',
|
|
|
|
stringify: JSON.stringify,
|
|
|
|
parse: JSON.parse,
|
|
|
|
encoding: 'utf8',
|
|
|
|
logging: false, // can also be custom logging function
|
|
|
|
continuous: true, // continously persist to disk
|
|
|
|
interval: false, // milliseconds, persist to disk on an interval
|
|
|
|
ttl: false, // ttl* [NEW], can be true for 24h default or a number in MILLISECONDS
|
|
|
|
expiredInterval: 2 * 60 * 1000, // [NEW] every 2 minutes the process will clean-up the expired cache
|
|
|
|
forgiveParseErrors: false // [NEW]
|
|
|
|
}).then((res) => {
|
|
|
|
//console.dir(res)
|
|
|
|
storage.getItem('_state', 'test').then(intval._setState).catch((err) => {
|
|
|
|
intval._setState(undefined)
|
|
|
|
log.error('init', err)
|
|
|
|
})
|
|
|
|
}).catch((err) => {
|
|
|
|
log.error('init', err)
|
|
|
|
})
|
|
|
|
|
|
|
|
intval._frame = {
|
|
|
|
open : 250, //delay before pausing frame in open state
|
|
|
|
openBwd : 400,
|
|
|
|
closed : 100, //time that frame actually remains closed for
|
|
|
|
expected : 630 //expected length of frame, in ms
|
|
|
|
}
|
|
|
|
intval._release = {
|
|
|
|
min : 20,
|
|
|
|
seq : 1000
|
|
|
|
}
|
|
|
|
intval._microDelay = 10 // delay after stop signal before stopping motors
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._pin = {}
|
2017-10-23 16:58:37 +00:00
|
|
|
|
|
|
|
intval._declarePins()
|
|
|
|
process.on('SIGINT', intval._undeclarePins)
|
|
|
|
process.on('uncaughtException', intval._undeclarePins)
|
|
|
|
}
|
|
|
|
|
|
|
|
intval._setState = function (data) {
|
|
|
|
if (typeof data !== 'undefined') {
|
|
|
|
intval._state = data
|
|
|
|
intval._state.frame.cb = () => {}
|
|
|
|
log.info('_setState', 'Restored intval state from disk')
|
|
|
|
return true
|
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._state = {
|
|
|
|
frame : {
|
2017-10-21 15:46:06 +00:00
|
|
|
dir : true, //forward
|
2017-10-20 23:36:23 +00:00
|
|
|
start : 0, //time frame started, timestamp
|
2017-10-20 01:52:13 +00:00
|
|
|
active : false, //should frame be running
|
2017-10-21 00:19:29 +00:00
|
|
|
paused : false,
|
2017-10-21 15:46:06 +00:00
|
|
|
exposure : 0, //length of frame exposure, in ms
|
2017-10-21 16:08:12 +00:00
|
|
|
delay : 0, //delay before start of frame, in ms
|
|
|
|
cb : () => {}
|
2017-10-20 01:52:13 +00:00
|
|
|
},
|
|
|
|
release : {
|
|
|
|
time: 0,
|
|
|
|
active : false //is pressed
|
|
|
|
},
|
|
|
|
micro : {
|
|
|
|
time : 0,
|
|
|
|
primed : false //is ready to stop frame
|
2017-10-22 23:59:38 +00:00
|
|
|
},
|
|
|
|
counter : 0
|
2017-09-16 17:35:39 +00:00
|
|
|
}
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState = function () {
|
2017-10-24 00:31:24 +00:00
|
|
|
storage.setItem('_state', intval._state)
|
2017-10-23 16:58:37 +00:00
|
|
|
.then(() => {})
|
|
|
|
.catch((err) => {
|
|
|
|
log.error('_storeState', err)
|
|
|
|
})
|
2017-10-20 01:52:13 +00:00
|
|
|
}
|
2017-10-23 16:58:37 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
/**
|
|
|
|
* (internal function) Declares all Gpio pins that will be used
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._declarePins = function () {
|
|
|
|
let pin
|
|
|
|
for (let p in PINS) {
|
|
|
|
pin = PINS[p]
|
|
|
|
if (pin.edge) intval._pin[p] = Gpio(pin.pin, pin.dir, pin.edge)
|
|
|
|
if (!pin.edge) intval._pin[p] = Gpio(pin.pin, pin.dir)
|
|
|
|
log.info('_declarePins', { pin : pin.pin, dir : pin.dir, edge : pin.edge })
|
2017-08-22 04:49:08 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._pin.release.watch(intval._watchRelease)
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* (internal function) Undeclares all Gpio in event of uncaught error
|
|
|
|
* that interupts the node process
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._undeclarePins = function (e) {
|
|
|
|
log.error(e)
|
|
|
|
if (!intval._pin) {
|
|
|
|
log.warn('_undeclarePins', { reason : 'No pins'})
|
|
|
|
return process.exit()
|
2017-08-22 04:49:08 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
log.warn('_undeclarePins', { pin : PINS.fwd.pin, val : 0, reason : 'exiting'})
|
|
|
|
intval._pin.fwd.writeSync(0)
|
|
|
|
log.warn('_undeclarePins', { pin : PINS.bwd.pin, val : 0, reason : 'exiting'})
|
|
|
|
intval._pin.bwd.writeSync(0)
|
|
|
|
intval._pin.fwd.unexport()
|
|
|
|
intval._pin.bwd.unexport()
|
|
|
|
intval._pin.micro.unexport()
|
|
|
|
intval._pin.release.unexport()
|
|
|
|
process.exit()
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Start motor in forward direction by setting correct pins in h-bridge
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._startFwd = function () {
|
|
|
|
intval._pin.fwd.writeSync(1)
|
|
|
|
intval._pin.bwd.writeSync(0)
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Start motor in backward direction by setting correct pins in h-bridge
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._startBwd = function () {
|
|
|
|
intval._pin.fwd.writeSync(0)
|
|
|
|
intval._pin.bwd.writeSync(1)
|
|
|
|
}
|
2017-10-20 23:36:23 +00:00
|
|
|
|
|
|
|
intval._pause = function () {
|
|
|
|
intval._pin.fwd.writeSync(0)
|
2017-10-21 01:03:47 +00:00
|
|
|
intval._pin.bwd.writeSync(0)
|
2017-10-21 01:05:00 +00:00
|
|
|
//log.info('_pause', 'frame paused')
|
2017-10-20 23:36:23 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
/**
|
|
|
|
* Stop motor by setting both motor pins to 0 (LOW)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._stop = function () {
|
|
|
|
intval._pin.fwd.writeSync(0)
|
|
|
|
intval._pin.bwd.writeSync(0)
|
2017-10-20 02:03:13 +00:00
|
|
|
const now = +new Date()
|
|
|
|
const len = now - intval._state.frame.start
|
2017-09-19 00:46:18 +00:00
|
|
|
|
2017-10-21 01:10:01 +00:00
|
|
|
log.info(`_stop`, { frame : len })
|
2017-09-19 00:46:18 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._pin.micro.unwatch()
|
|
|
|
intval._state.frame.active = false
|
2017-10-21 16:23:37 +00:00
|
|
|
if (intval._state.frame.cb) intval._state.frame.cb(len)
|
2017-10-20 01:52:13 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Callback for watching relese switch state changes.
|
|
|
|
* Using GPIO 06 on Raspberry Pi Zero W.
|
|
|
|
*
|
|
|
|
* 1) If closed AND frame active, start timer, set state primed to `true`.
|
|
|
|
* 1) If opened AND frame active, stop frame
|
|
|
|
*
|
|
|
|
* Microswitch + 10K ohm resistor
|
|
|
|
* * 1 === open
|
|
|
|
* * 0 === closed
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param {object} err Error object present if problem reading pin
|
|
|
|
* @param {integer} val Current value of the pin
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._watchMicro = function (err, val) {
|
2017-10-21 23:31:52 +00:00
|
|
|
const now = +new Date()
|
2017-10-20 01:52:13 +00:00
|
|
|
if (err) {
|
|
|
|
log.error('_watchMicro', err)
|
2017-09-19 00:46:18 +00:00
|
|
|
}
|
2017-10-21 01:10:01 +00:00
|
|
|
//log.info(`Microswitch val: ${val}`)
|
2017-10-20 01:52:13 +00:00
|
|
|
//determine when to stop
|
|
|
|
if (val === 0 && intval._state.frame.active) {
|
|
|
|
if (!intval._state.micro.primed) {
|
|
|
|
intval._state.micro.primed = true
|
2017-10-21 23:31:52 +00:00
|
|
|
intval._state.micro.time = now
|
2017-10-21 01:10:01 +00:00
|
|
|
//log.info('Microswitch primed to stop motor')
|
2017-08-29 12:23:52 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
} else if (val === 1 && intval._state.frame.active) {
|
2017-10-21 23:31:52 +00:00
|
|
|
if (intval._state.micro.primed && !intval._state.micro.paused && (now - intval._state.frame.start) > intval._frame.open) {
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._state.micro.primed = false
|
2017-10-21 23:31:52 +00:00
|
|
|
intval._state.micro.time = 0
|
2017-10-20 02:13:34 +00:00
|
|
|
//setTimeout( () => {
|
2017-10-20 02:03:13 +00:00
|
|
|
intval._stop()
|
2017-10-20 02:13:34 +00:00
|
|
|
//}, intval._microDelay)
|
2017-09-25 02:28:26 +00:00
|
|
|
}
|
2017-08-29 12:23:52 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Callback for watching relese switch state changes.
|
|
|
|
* Using GPIO 05 on Raspberry Pi Zero W.
|
|
|
|
*
|
|
|
|
* 1) If closed, start timer.
|
|
|
|
* 2) If opened, check timer AND
|
2017-10-21 15:54:45 +00:00
|
|
|
* 3) If `press` (`now - intval._state.release.time`) greater than minimum and less than `intval._release.seq`, start frame
|
2017-10-21 00:54:35 +00:00
|
|
|
* 4) If `press` greater than `intval._release.seq`, start sequence
|
2017-10-20 01:52:13 +00:00
|
|
|
*
|
|
|
|
* Button + 10K ohm resistor
|
|
|
|
* * 1 === open
|
|
|
|
* * 0 === closed
|
|
|
|
*
|
|
|
|
* @param {object} err Error object present if problem reading pin
|
|
|
|
* @param {integer} val Current value of the pin
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval._watchRelease = function (err, val) {
|
|
|
|
const now = +new Date()
|
|
|
|
let press = 0
|
|
|
|
if (err) {
|
|
|
|
return log.error(err)
|
|
|
|
}
|
2017-10-21 15:54:45 +00:00
|
|
|
//log.info(`Release switch val: ${val}`)
|
2017-10-20 01:52:13 +00:00
|
|
|
if (val === 0) {
|
|
|
|
//closed
|
|
|
|
if (intval._releaseClosedState(now)) {
|
2017-10-21 15:54:45 +00:00
|
|
|
intval._state.release.time = now
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._state.release.active = true //maybe unncecessary
|
2017-08-28 12:49:47 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
} else if (val === 1) {
|
|
|
|
//opened
|
|
|
|
if (intval._state.release.active) {
|
2017-10-21 15:54:45 +00:00
|
|
|
press = now - intval._state.release.time
|
2017-10-21 00:54:35 +00:00
|
|
|
if (press > intval._release.min && press < intval._release.seq) {
|
2017-10-20 01:52:13 +00:00
|
|
|
intval.frame()
|
2017-10-21 00:54:35 +00:00
|
|
|
} else if (press >= intval._release.seq) {
|
2017-10-20 01:52:13 +00:00
|
|
|
intval.sequence()
|
2017-09-17 23:51:33 +00:00
|
|
|
}
|
2017-10-21 01:05:00 +00:00
|
|
|
//log.info(`Release closed for ${press}ms`)
|
2017-10-21 15:54:45 +00:00
|
|
|
intval._state.release.time = 0
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._state.release.active = false
|
2017-09-17 23:51:33 +00:00
|
|
|
}
|
2017-08-28 12:49:47 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
}
|
2017-10-20 01:30:07 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._releaseClosedState = function (now) {
|
2017-10-21 15:54:45 +00:00
|
|
|
if (!intval._state.release.active && intval._state.release.time === 0) {
|
2017-10-20 01:52:13 +00:00
|
|
|
return true
|
|
|
|
}
|
2017-10-21 15:54:45 +00:00
|
|
|
if (intval._state.release.active && (now - intval._state.release.time) > (intval._release.seq * 10)) {
|
2017-10-20 01:52:13 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2017-10-23 17:32:45 +00:00
|
|
|
|
|
|
|
intval.reset = function () {
|
|
|
|
intval._setState(undefined)
|
|
|
|
intval._storeState()
|
|
|
|
}
|
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
/**
|
|
|
|
* Set the default direction of the camera.
|
|
|
|
* * forward = true
|
|
|
|
* * backward = false
|
|
|
|
*
|
|
|
|
* @param {boolean} [dir=true] Direction of the camera
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval.setDir = function (val = true) {
|
|
|
|
if (typeof val !== 'boolean') {
|
|
|
|
return log.warn('Direction must be represented as either true or false')
|
|
|
|
}
|
2017-10-21 15:46:06 +00:00
|
|
|
intval._state.frame.dir = val
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
2017-10-21 00:45:21 +00:00
|
|
|
log.info('setDir', { direction : val ? 'forward' : 'backward' })
|
2017-10-20 23:36:23 +00:00
|
|
|
}
|
2017-10-21 15:46:06 +00:00
|
|
|
|
|
|
|
intval.setExposure = function (val = 0) {
|
|
|
|
intval._state.frame.exposure = val
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
2017-10-23 04:30:08 +00:00
|
|
|
log.info('setExposure', { exposure : val })
|
2017-10-20 01:52:13 +00:00
|
|
|
}
|
2017-10-21 15:46:06 +00:00
|
|
|
|
2017-10-20 23:36:23 +00:00
|
|
|
intval.setDelay = function (val = 0) {
|
|
|
|
intval._state.frame.delay = val
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
2017-10-20 23:44:58 +00:00
|
|
|
log.info('setDelay', { delay : val })
|
2017-10-20 23:36:23 +00:00
|
|
|
}
|
2017-10-22 23:59:38 +00:00
|
|
|
intval.setCounter = function (val = 0) {
|
|
|
|
intval._state.counter = val
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
2017-10-22 23:59:38 +00:00
|
|
|
log.info('setCounter', { counter : val })
|
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
/**
|
|
|
|
* Begin a single frame with set variables or defaults
|
|
|
|
*
|
|
|
|
* @param {?boolean} [dir="null"] (optional) Direction of the frame
|
|
|
|
* @param {?integer} [time="null"] (optional) Exposure time, 0 = minimum
|
|
|
|
*
|
|
|
|
*/
|
2017-10-21 16:08:12 +00:00
|
|
|
intval.frame = function (dir = null, time = null, cb = () => {}) {
|
2017-10-21 15:46:06 +00:00
|
|
|
if (dir === true || (dir === null && intval._state.frame.dir === true) ) {
|
2017-10-20 01:52:13 +00:00
|
|
|
dir = true
|
|
|
|
} else {
|
|
|
|
dir = false
|
|
|
|
}
|
|
|
|
|
2017-10-21 15:46:06 +00:00
|
|
|
if (time === null && intval._state.frame.exposure !== 0) {
|
|
|
|
time = intval._state.frame.exposure
|
2017-10-20 23:53:57 +00:00
|
|
|
} else if (time === null) {
|
|
|
|
time = 0 //default speed
|
2017-10-20 01:30:07 +00:00
|
|
|
}
|
2017-09-17 23:51:33 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
intval._state.frame.start = +new Date()
|
|
|
|
intval._state.frame.active = true
|
|
|
|
intval._pin.micro.watch(intval._watchMicro)
|
2017-09-17 23:51:33 +00:00
|
|
|
|
2017-10-21 16:23:37 +00:00
|
|
|
log.info('frame', {dir : dir ? 'forward' : 'backward', exposure : time})
|
2017-09-26 03:26:13 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
if (dir) {
|
|
|
|
intval._startFwd()
|
|
|
|
} else {
|
|
|
|
intval._startBwd()
|
2017-08-22 04:00:24 +00:00
|
|
|
}
|
2017-10-20 23:53:57 +00:00
|
|
|
if (time !== 0) {
|
2017-10-21 00:29:14 +00:00
|
|
|
intval._state.frame.paused = true
|
2017-10-20 23:36:23 +00:00
|
|
|
if (dir) {
|
2017-10-21 15:46:06 +00:00
|
|
|
setTimeout(intval._pause, intval._frame.open)
|
|
|
|
//log.info('frame', { pausing : time + intval._frame.open })
|
2017-10-21 00:19:29 +00:00
|
|
|
setTimeout( () => {
|
|
|
|
intval._state.frame.paused = false
|
2017-10-20 23:58:16 +00:00
|
|
|
intval._startFwd()
|
2017-10-21 15:46:06 +00:00
|
|
|
}, time + intval._frame.closed)
|
2017-10-20 23:36:23 +00:00
|
|
|
} else {
|
2017-10-21 15:46:06 +00:00
|
|
|
setTimeout(intval._pause, intval._frame.openBwd)
|
2017-10-21 00:19:29 +00:00
|
|
|
setTimeout( () => {
|
2017-10-21 01:05:00 +00:00
|
|
|
//log.info('frame', 'restarting')
|
2017-10-21 00:19:29 +00:00
|
|
|
intval._state.frame.paused = false
|
|
|
|
intval._startBwd()
|
2017-10-21 15:46:06 +00:00
|
|
|
}, time + intval._frame.closed)
|
2017-10-20 23:36:23 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-22 23:59:38 +00:00
|
|
|
if (dir) {
|
|
|
|
intval._state.frame.cb = (len) => {
|
|
|
|
intval._state.counter++
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
2017-10-22 23:59:38 +00:00
|
|
|
cb(len)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
intval._state.frame.cb = (len) => {
|
|
|
|
intval._state.counter--
|
2017-10-23 16:58:37 +00:00
|
|
|
intval._storeState()
|
2017-10-22 23:59:38 +00:00
|
|
|
cb(len)
|
|
|
|
}
|
2017-10-21 16:21:15 +00:00
|
|
|
}
|
2017-08-22 03:52:27 +00:00
|
|
|
}
|
2017-10-20 01:52:13 +00:00
|
|
|
/**
|
|
|
|
* Start a sequence of frames, using defaults or explicit instructions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
intval.sequence = function () {
|
|
|
|
log.info('sequence', `Started sequence`)
|
|
|
|
}
|
|
|
|
intval.status = function () {
|
|
|
|
return intval._state
|
|
|
|
}
|
2017-08-22 03:52:27 +00:00
|
|
|
|
2017-10-20 01:52:13 +00:00
|
|
|
module.exports = intval
|