lib/format.js
function parseAssetSymbol(assetSymbol) {
    var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

    assert.equal(typeof assetSymbol === 'undefined' ? 'undefined' : (0, _typeof3.default)(assetSymbol), "string", "Asset symbol should be string");

    if (assetSymbol.indexOf(",") === -1) {
        assetSymbol = ',' + assetSymbol; // null precision
    }
    var v = assetSymbol.split(",");
    assert(v.length === 2, 'Asset symbol "' + assetSymbol + '" may have a precision like this: 4,SYM');

    var symbolPrecision = v[0] == "" ? null : parseInt(v[0]);
    var symbol = v[1];

    if (precision != null) {
        assert.equal(precision, symbolPrecision, "Asset symbol precision mismatch");
    } else {
        precision = symbolPrecision;
    }

    if (precision != null) {
        assert.equal(typeof precision === 'undefined' ? 'undefined' : (0, _typeof3.default)(precision), "number", "precision");
        assert(precision > -1, "precision must be positive");
    }

    if (!/^[0-9]+$/.test(symbol)) {
        if (/^S#[0-9]+$/.test(symbol)) {
            symbol = symbol.replace("S#", "");
        } else {
            throw new Error('Asset symbol should looks like \'S#{num}\', but got ' + symbol + '.');
        }
    }
    assert(precision <= 18, "Precision should be 18 characters or less");
    assert(symbol.length <= 7, "Asset symbol is 7 characters or less");

    return { precision: precision, symbol: symbol };
}
function parseAssetSymbol(assetSymbol) {
    var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

    assert.equal(typeof assetSymbol === 'undefined' ? 'undefined' : (0, _typeof3.default)(assetSymbol), "string", "Asset symbol should be string");

    if (assetSymbol.indexOf(",") === -1) {
        assetSymbol = ',' + assetSymbol; // null precision
    }
    var v = assetSymbol.split(",");
    assert(v.length === 2, 'Asset symbol "' + assetSymbol + '" may have a precision like this: 4,SYM');

    var symbolPrecision = v[0] == "" ? null : parseInt(v[0]);
    var symbol = v[1];

    if (precision != null) {
        assert.equal(precision, symbolPrecision, "Asset symbol precision mismatch");
    } else {
        precision = symbolPrecision;
    }

    if (precision != null) {
        assert.equal(typeof precision === 'undefined' ? 'undefined' : (0, _typeof3.default)(precision), "number", "precision");
        assert(precision > -1, "precision must be positive");
    }

    if (!/^[0-9]+$/.test(symbol)) {
        if (/^S#[0-9]+$/.test(symbol)) {
            symbol = symbol.replace("S#", "");
        } else {
            throw new Error('Asset symbol should looks like \'S#{num}\', but got ' + symbol + '.');
        }
    }
    assert(precision <= 18, "Precision should be 18 characters or less");
    assert(symbol.length <= 7, "Asset symbol is 7 characters or less");

    return { precision: precision, symbol: symbol };
}
@arg {string} assetSymbol - 4,SYM
@arg {number} [precision = null] - expected precision or mismatch AssertionError

@example assert.deepEqual(parseAssetSymbol('SYM'), {precision: null, symbol: 'SYM'})
@example assert.deepEqual(parseAssetSymbol('4,SYM'), {precision: 4, symbol: 'SYM'})
@throws AssertionError
@throws TypeError