Travis build: 940
This commit is contained in:
29
README.md
29
README.md
@ -341,6 +341,7 @@ _30s.average(1, 2, 3);
|
||||
* [`atob`](#atob)
|
||||
* [`btoa`](#btoa)
|
||||
* [`colorize`](#colorize)
|
||||
* [`createDirIfNotExists`](#createdirifnotexists)
|
||||
* [`hasFlags`](#hasflags)
|
||||
* [`hashNode`](#hashnode)
|
||||
* [`isDuplexStream`](#isduplexstream)
|
||||
@ -2316,9 +2317,9 @@ The `func` is invoked with three arguments (`value, index, array`).
|
||||
const remove = (arr, func) =>
|
||||
Array.isArray(arr)
|
||||
? arr.filter(func).reduce((acc, val) => {
|
||||
arr.splice(arr.indexOf(val), 1);
|
||||
return acc.concat(val);
|
||||
}, [])
|
||||
arr.splice(arr.indexOf(val), 1);
|
||||
return acc.concat(val);
|
||||
}, [])
|
||||
: [];
|
||||
```
|
||||
|
||||
@ -6318,6 +6319,28 @@ console.log(colorize(colorize('foo').yellow, colorize('foo').green).bgWhite); //
|
||||
|
||||
<br>[⬆ Back to top](#contents)
|
||||
|
||||
### createDirIfNotExists
|
||||
|
||||
Creates a directory, if it does not exist.
|
||||
|
||||
Use `fs.existsSync()` to check if the directory exists, `fs.mkdirSync()` to create it.
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const createDirIfNotExists = dir => (!fs.existsSync(dir) ? fs.mkdirSync(dir) : undefined);
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
createDirIfNotExists('test'); // creates the directory 'test', if it doesn't exist
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#contents)
|
||||
|
||||
### hasFlags
|
||||
|
||||
Check if the current process's arguments contain the specified flags.
|
||||
|
||||
Reference in New Issue
Block a user