1.0.0 • Published 4 years ago
@feizheng/next-try-set-get v1.0.0
next-try-set-get
Try to set value then return the value.
installation
npm install -S @feizheng/next-try-set-get
usage
import '@feizheng/next-try-set-get';
const obj = { name: 'fei', email: '1290657123@qq.com' };
const res1 = nx.trySetGet(obj, 'name', 'feizheng');
const res2 = nx.trySetGet(obj, 'github', 'afeiship');
// results:
// afei
// afeiship
1.0.0
4 years ago