@darkwolf/helper
v21.13.7
Published
Helper
Downloads
76
Readme
Helper
Install
npm i --save @darkwolf/helper
Using
⚠️ Requires Node.js v12.x LTS or higher to use!
import Helper from '@darkwolf/helper'
const obj = {
ave: {
darkwolf: {
arr: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
}
}
}
Helper.get(obj, 'ave.darkwolf') // {arr: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]}
Helper.get(obj, ['ave', 'darkwolf', 'arr', '[-1]']) // 1024
Helper.get(obj, ['ave.darkwolf.arr[-11]']) // 2
Helper.set(obj, 'ave.darkwolf', 'Ave, Darkwolf!') // 'Ave, Darkwolf!'
obj.ave.darkwolf // 'Ave, Darkwolf!'
Helper.template('Ave, @{username}!', {
username: 'PavelWolfDark'
}) // 'Ave, @PavelWolfDark!'
Helper.template('WFC: {wallet.balance}', {
wallet: {
balance: '1.00000001'
}
}) // 'WFC: 1.00000001'