Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

to-length

v4.17.15arrow_drop_down
v4.17.15
v4.17.11
STATUS
Passing
DOWNLOADS
148
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
4 months ago
SIZE
N/A
Converts `value` to an integer suitable for use as the length of an
2 contributors
Install to-length as a package?
Copied
npm i @bit/lodash.lodash.to-length
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
modifieddraft
chevron_left
chevron_right
toLength (
value:*
) : number

Converts value to an integer suitable for use as the length of an array-like object.

Note: This method is based on ToLength.

Example
toLength(3.2)
// => 3

toLength(Number.MIN_VALUE)
// => 0

toLength(Infinity)
// => 4294967295

toLength('3.2')
// => 3
Argument
value: *

The value to convert.

Returns
number

Returns the converted integer.