This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

12 lines
202 B
JavaScript

'use strict'
module.exports = function asInt (value) {
const n = parseInt(value, 10)
if (isNaN(n) || n.toString(10) !== value) {
throw new Error('should be a valid integer')
}
return n
}