@gulujs/toml
Version:
TOML parser and serializer
13 lines (12 loc) • 351 B
JavaScript
import { RE_BOOLEAN } from '../constants.js';
export function getBoolean(source, offset) {
RE_BOOLEAN.lastIndex = offset;
const matches = RE_BOOLEAN.exec(source.line);
if (!matches || matches.index !== offset) {
return null;
}
return {
value: matches[1] === 'true',
nextIndex: RE_BOOLEAN.lastIndex
};
}