Travis build: 697 [ci skip]

This commit is contained in:
Travis CI
2017-12-31 10:44:48 +00:00
parent a7272b15b8
commit 2e306cd6db
4 changed files with 54 additions and 6 deletions

View File

@ -258,6 +258,15 @@
</details>
### _Uncategorized_
<details>
<summary>View contents</summary>
* [`size`](#size)
</details>
---
## 🔌 Adapter
@ -4296,6 +4305,37 @@ yesNo('Foo', true); // true
<br>[⬆ Back to top](#table-of-contents)
---
## _Uncategorized_
### size
Get size of arrays, objects or strings.
Get type of `value` (`array`, `object` or `string`).
Use `length` property for arrays.
Use `length` or `size` value if available or number of keys for objects.
Use `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API/Blob) created from `value` for strings.
Split strings into array of characters with `split('')` and return its length.
```js
const size = value =>
Array.isArray(value)
? value.length
: value && typeof value === 'object'
? value.size || value.length || Object.keys(value).length
: typeof value === 'string' ? new Blob([value]).size : 0;
```
```js
size([1, 2, 3, 4, 5]); // 5
size('size'); // 4
size({ one: 1, two: 2, three: 3 }); // 3
```
<br>[⬆ back to top](#table-of-contents)
## Credits

File diff suppressed because one or more lines are too long

View File

@ -15,9 +15,7 @@ const size = value =>
? value.length
: value && typeof value === 'object'
? value.size || value.length || Object.keys(value).length
: typeof value === 'string'
? new Blob([value]).size
: 0;
: typeof value === 'string' ? new Blob([value]).size : 0;
```
```js

View File

@ -121,6 +121,7 @@ shallowClone:object
show:browser
shuffle:array
similarity:array
size:uncategorized
sleep:function
sortCharactersInString:string
speechSynthesis:browser