Travis build: 802 [ci skip]
This commit is contained in:
@ -7,9 +7,7 @@ Use a regular expression to test if the specified flags are prefixed with `-` or
|
||||
|
||||
```js
|
||||
const hasFlags = (...flags) =>
|
||||
flags.every(flag => process.argv.includes(
|
||||
/^-{1,2}/.test(flag) ? flag : '--' + flag
|
||||
));
|
||||
flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag));
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
@ -5,9 +5,13 @@ Inverts the key-value pairs of an object, without mutating it.
|
||||
Use `Object.keys()` and `Array.reduce()` to invert the key-value pairs of an object.
|
||||
|
||||
```js
|
||||
const invertKeyValues = obj => Object.keys(obj).reduce((acc,key) => { acc[obj[key]] = key; return acc;},{});
|
||||
const invertKeyValues = obj =>
|
||||
Object.keys(obj).reduce((acc, key) => {
|
||||
acc[obj[key]] = key;
|
||||
return acc;
|
||||
}, {});
|
||||
```
|
||||
|
||||
```js
|
||||
invertKeyValues({name:'John', age: 20}) // { 20: 'age', John: 'name' }
|
||||
invertKeyValues({ name: 'John', age: 20 }); // { 20: 'age', John: 'name' }
|
||||
```
|
||||
|
||||
@ -5,6 +5,7 @@ Checks if the current environment is [Travis CI](https://travis-ci.org/).
|
||||
Checks if the current environment has the `TRAVIS` and `CI` environment variables ([reference](https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)).
|
||||
|
||||
```js
|
||||
|
||||
const isTravisCI = ()) => 'TRAVIS' in process.env && 'CI' in process.env;
|
||||
```
|
||||
|
||||
|
||||
@ -9,5 +9,5 @@ const untildify = str => str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$
|
||||
```
|
||||
|
||||
```js
|
||||
untildify('~/node') // '/Users/aUser/node'
|
||||
untildify('~/node'); // '/Users/aUser/node'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user