Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ToLength.js « 2019 « es-abstract « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1bef9bed7b2f0cbbd9477769cb4bcdeb3b8814bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
'use strict';

var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');

var ToInteger = require('./ToInteger');

module.exports = function ToLength(argument) {
	var len = ToInteger(argument);
	if (len <= 0) { return 0; } // includes converting -0 to +0
	if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
	return len;
};