bobbotag
v1.0.6
Published
A simple node module to detect and manage tags on input strings.
Downloads
10
Readme
Bobbotag
A simple node module to detect and manage tags on input strings.
Usage
const Bobbotag = require('bobbotag')
let users = {
foo: {
value: '12',
label: 'Foo Bar'
},
bar: {
value: '42',
label: 'Bar Foo'
}
}
let text = ''
const bobbo = new Bobbotag({
tag: '@',
tagReplaced: '#@#'
})
function onChangeText(newText) {
bobbo.changeText(newText)
if (bobbo.getCurrentTag() && users[bobbo.getCurrentTag()]) {
bobbo.replaceCurrentTag(
users[bobbo.getCurrentTag()]
)
}
text = bobbo.getPrettyText()
}
function onSubmit() {
console.log('Pretty:', bobbo.getPrettyText())
console.log('Real:', bobbo.getText())
console.log('Tags:', bobbo.getTags())
}
TODO
- Write a better documentation.