1.0.4 • Published 4 years ago
@darkwolf/text v1.0.4
Text
Install
npm i --save @darkwolf/text
Using
⚠️ Requires Node.js v12.x LTS or higher to use!
import Text from '@darkwolf/text'
const text = new Text('Ave, @{username}!')
text.template({username: 'PavelWolfDark'}) // 'Ave, @PavelWolfDark!'
text.insert({username: 'PavelWolfDark'}).value // 'Ave, @PavelWolfDark!'
const other = text
.clone()
.newLine()
.add('WFC: {wallet.wfc}')
.insert({
wallet: {
wfc: '1.00000001'
}
})
text.value // 'Ave, @PavelWolfDark!'
other.value // 'Ave, @PavelWolfDark!\nWFC: 1.00000001'
const template = `${new Text('Ave, Darkwolf!').newLine()}${other}` // 'Ave, Darkwolf!\nAve, @PavelWolfDark!\nWFC: 1.00000001'