any-size

Get the size of a value. Supports objects, array-like values, strings (with ansi stripping and unicode character recognition), numbers, bigints, maps, sets and array buffers.

Usage no npm install needed!

<script type="module">
  import anySize from 'https://cdn.skypack.dev/any-size';
</script>

README

any-size Travis CI Build Status

Get the size of a value. Supports objects, array-like values, strings (with ansi stripping and unicode character recognition), numbers, bigints, maps, sets and array buffers.

NPM Badge

Install

npm install any-size

Usage

const size = require("any-size")

size("unicorns")
//=> 8
 
size([1, 2, 3, 4, 5])
//=> 5

size({a: 1, b: 2, c: 3})
//=> 3

API

anySize(input)

input

Type: any

The value to get the size of.