Merge pull request #403 from clark800/no-limit

Get all results when limit is not specified
This commit is contained in:
sublimator
2015-07-14 06:52:20 +08:00
4 changed files with 14 additions and 13 deletions

View File

@@ -1,9 +1,15 @@
'use strict';
const _ = require('lodash');
const assert = require('assert');
const common = require('../common');
const dropsToXrp = common.dropsToXrp;
const composeAsync = common.composeAsync;
function clamp(value, min, max) {
assert(min <= max, 'Illegal clamp bounds');
return Math.min(Math.max(value, min), max);
}
function getXRPBalance(remote, address, ledgerVersion, callback) {
remote.requestAccountInfo({account: address, ledger: ledgerVersion},
composeAsync((data) => dropsToXrp(data.account_data.Balance), callback));
@@ -29,7 +35,7 @@ function getRecursiveRecur(getter, marker, limit, callback) {
}
function getRecursive(getter, limit, callback) {
getRecursiveRecur(getter, undefined, limit, callback);
getRecursiveRecur(getter, undefined, limit || Infinity, callback);
}
function renameCounterpartyToIssuer(amount) {
@@ -86,6 +92,7 @@ module.exports = {
getRecursive,
hasCompleteLedgerRange,
wrapCatch: common.wrapCatch,
clamp: clamp,
common: common
};