How to use the fromString function from bytebuffer

Find comprehensive JavaScript bytebuffer.fromString code examples handpicked from public code repositorys.

266
267
268
269
270
271
272
273
274
275
if (/\.$/.test(value) ){
    // remove trailing dot
    value = value.substring(0, value.length - 1);
}
if (value === "") { value = "0"; }
var long_string = Long.fromString(value).toString();
if (long_string !== value.trim()) {
    throw new Error(`overflow ${field_name} ${value}`);
}
return;
fork icon0
star icon2
watch icon3

42
43
44
45
46
47
48
49
50
51
    value: function fromString(value) {
        if (value.space !== undefined && value.type !== undefined && value.instance !== undefined) {
            return value;
        }
        var params = v.require_match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/, v.required(value, "object_id"), "object_id");
        return new ObjectId(parseInt(params[1]), parseInt(params[2]), Long.fromString(params[3]));
    }
}, {
    key: 'fromLong',
    value: function fromLong(long) {
fork icon0
star icon0
watch icon1

+ 2 other calls in file

29
30
31
32
33
34
35
36
37
38
        "object_id"
    );
    return new ObjectId(
        parseInt(params[1]),
        parseInt(params[2]),
        Long.fromString(params[3])
    );
}

static fromLong(long){
fork icon0
star icon0
watch icon1