Open-source IoT Platform - Device management, data collection, processing and visualization.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
1017 B

'use strict'
module.exports = text
function text(eat, value, silent) {
var self = this
var methods
var tokenizers
var index
var length
var subvalue
var position
var tokenizer
var name
var min
var now
/* istanbul ignore if - never used (yet) */
if (silent) {
return true
}
methods = self.inlineMethods
length = methods.length
tokenizers = self.inlineTokenizers
index = -1
min = value.length
while (++index < length) {
name = methods[index]
if (name === 'text' || !tokenizers[name]) {
continue
}
tokenizer = tokenizers[name].locator
if (!tokenizer) {
eat.file.fail('Missing locator: `' + name + '`')
}
position = tokenizer.call(self, value, 1)
if (position !== -1 && position < min) {
min = position
}
}
subvalue = value.slice(0, min)
now = eat.now()
self.decode(subvalue, now, handler)
function handler(content, position, source) {
eat(source || content)({type: 'text', value: content})
}
}