Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/molnarmark/assign-if

✔ Call Object.assign if an expression is truthy
https://github.com/molnarmark/assign-if

Last synced: about 1 month ago
JSON representation

✔ Call Object.assign if an expression is truthy

Awesome Lists containing this project

README

        

# ✔Assign If

> call `Object.assign` if the passed expression evaluates to true.

## Usage
```javascript
const assignIf = require('assign-if');

const evaluation = assignIf({a: 1, b: 2}, {c: 3}, 5 > 4);
//=> {success: true, object: {a: 1, b: 2, c: 3}}

const evaluation2 = assignIf({a: 1, b: 2}, {c: 3}, 1 == 2);
//=> {success: false, object: {a: 1, b: 2}}
```

## License
- MIT