Нема описа

1234567891011121314151617181920
  1. /*!
  2. * is-odd <https://github.com/jonschlinkert/is-odd>
  3. *
  4. * Copyright (c) 2015-2017, Jon Schlinkert.
  5. * Released under the MIT License.
  6. */
  7. 'use strict';
  8. var isNumber = require('is-number');
  9. module.exports = function isOdd(i) {
  10. if (!isNumber(i)) {
  11. throw new TypeError('is-odd expects a number.');
  12. }
  13. if (Number(i) !== Math.floor(i)) {
  14. throw new RangeError('is-odd expects an integer.');
  15. }
  16. return !!(~~i & 1);
  17. };