Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/molnarmark/assign-if
- Owner: molnarmark
- License: mit
- Created: 2018-04-05T13:13:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T13:28:46.000Z (over 6 years ago)
- Last Synced: 2024-11-12T18:54:39.146Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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