You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
519 B

  1. 'use strict';
  2. /*!
  3. * Module requirements.
  4. */
  5. var Types = {
  6. Number: require('../number')
  7. };
  8. /*!
  9. * @ignore
  10. */
  11. exports.castToNumber = castToNumber;
  12. exports.castArraysOfNumbers = castArraysOfNumbers;
  13. /*!
  14. * @ignore
  15. */
  16. function castToNumber(val) {
  17. return Types.Number.prototype.cast.call(this, val);
  18. }
  19. function castArraysOfNumbers(arr, self) {
  20. arr.forEach(function(v, i) {
  21. if (Array.isArray(v)) {
  22. castArraysOfNumbers(v, self);
  23. } else {
  24. arr[i] = castToNumber.call(self, v);
  25. }
  26. });
  27. }