How to use the fromValue function from long

Find comprehensive JavaScript long.fromValue code examples handpicked from public code repositorys.

83
84
85
86
87
88
89
90
91
92
}

writeLong(value) {
    try {
        if (!Long.isLong(value)) {
            value = Long.fromValue(value);
        }
    }
    catch (err) {
        throw Errors.IgniteClientError.valueCastError(value, BinaryUtils.TYPE_CODE.LONG);
fork icon50
star icon0
watch icon1

193
194
195
196
197
198
199
200
201
202
function isDouble(o) {
  return is.number(o) && !is.integer(o);
}

function writeLong(o) {
  o = Long.fromValue(o);
  const buf = new Buffer(8);
  buf.writeInt32BE(o.high, 0);
  buf.writeInt32BE(o.low, 4);
  return buf;
fork icon0
star icon10
watch icon12

157
158
159
160
161
162
163
164
165
166
	});
	chaincodes.push(chaincode);
}
const properties = fabproto6.gossip.Properties.create({
	chaincodes: chaincodes,
	ledger_height: Long.fromValue(ledgerHeight),
});
const stateInfo = fabproto6.gossip.StateInfo.create({
	properties: properties
});
fork icon0
star icon0
watch icon1

53
54
55
56
57
58
59
60
61
62
	'peer3.org3.example.com:9003'
];

const chaincodes = [{name: 'example', version: 'v2'}];
const highest = Long.fromValue(200);
const ledgerHeight = Long.fromValue(100);
const smaller = Long.fromValue(10);
const endorsement_plan_template = {
	plan_id: 'example',
	groups: {
fork icon0
star icon0
watch icon1

+ 23 other calls in file

217
218
219
220
221
222
223
224
225
	it('should return null if no block seen', () => {
		should.equal(eventService.getLastBlockNumber(), null);
	});

	it('should return a long if it has been seen', () => {
		eventService.lastBlockNumber = Long.fromValue(1);
		should.equal(eventService.getLastBlockNumber().toInt(), 1);
	});
});
fork icon0
star icon0
watch icon1

+ 13 other calls in file

581
582
583
584
585
586
587
588
589
590

	return keep_list;
}

_findHighest(peers) {
	let highest = Long.fromValue(0);
	for (const peer of peers) {
		try {
			if (peer.ledgerHeight.greaterThan(highest)) {
				highest = peer.ledgerHeight;
fork icon0
star icon0
watch icon1