tryParseInt.js 184 B

1234567891011
  1. 'use strict';
  2. function tryParseInt(input) {
  3. const output = parseInt(input, 10);
  4. if (Number.isNaN(output)) {
  5. return null;
  6. }
  7. return output;
  8. }
  9. module.exports = tryParseInt;