clamp.js 521 B

1234567891011121314
  1. 'use strict';
  2. var isPrototypeOf = require('../../internals/object-is-prototype-of');
  3. var numberMethod = require('../number/virtual/clamp');
  4. var NumberPrototype = String.prototype;
  5. module.exports = function (it) {
  6. var ownProperty = it.clamp;
  7. // eslint-disable-next-line es/no-nonstandard-string-prototype-properties -- safe
  8. if (typeof it == 'number' || it === NumberPrototype || (isPrototypeOf(NumberPrototype, it) && ownProperty === NumberPrototype.clamp)) {
  9. return numberMethod;
  10. }
  11. return ownProperty;
  12. };