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.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
24
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
8 months ago
SIZE
1 KB
Converts `value` to an integer suitable for use as the length of an
1 contributor
Use to-length in your project ?
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
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';
revert changes
reload
toggle layout
maximize
toLength(3.2);
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.