Skip to content

afeiship/next-try-set

Repository files navigation

next-try-set

Try to set value then return the value.

version license size download

installation

npm install -S @jswork/next-try-set

usage

import '@jswork/next-try-set';

const obj = { name: 'fei', email: '1290657123@qq.com' };
const res1 = nx.trySet(obj, 'name', 'feizheng');
const res2 = nx.trySet(obj, 'github', 'afeiship');

// results:

// afei
// afeiship

license

Code released under the MIT license.