chore: update util

This commit is contained in:
surunzi
2020-09-14 11:39:29 +08:00
parent d433115c1a
commit dcb306720c
2 changed files with 51 additions and 185 deletions

View File

@@ -1281,23 +1281,6 @@ const str =
extractUrls(str); // -> ['http://eustia.liriliri.io']
```
## fileSize
Turn bytes into human readable file size.
|Name |Desc |
|------|------------------|
|bytes |File bytes |
|return|Readable file size|
```javascript
fileSize(5); // -> '5'
fileSize(1500); // -> '1.46K'
fileSize(1500000); // -> '1.43M'
fileSize(1500000000); // -> '1.4G'
fileSize(1500000000000); // -> '1.36T'
```
## filter
Iterates over elements of collection, returning an array of all the values that pass a truth test.
@@ -1346,10 +1329,6 @@ a.b = 2;
console.log(a); // -> {b: 1}
```
## fullUrl
Add origin to url if needed.
## getFileName
Extract file name from url.
@@ -1704,20 +1683,6 @@ isNaN(0); // -> false
isNaN(NaN); // -> true
```
## isNative
Check if value is a native function.
|Name |Desc |
|------|----------------------------------|
|val |Value to check |
|return|True if value is a native function|
```javascript
isNative(function() {}); // -> false
isNative(Math.min); // -> true
```
## isNil
Check if value is null or undefined, the same as value == null.