2 * Copyright 2015-present Greg Hurrell. All rights reserved.
3 * Licensed under the terms of the MIT license.
10 import addDigits from './addDigits';
11 import getDigits from './getDigits';
12 import joinDigits from './joinDigits';
15 * Adds two numbers `a` and `b`, both in `base` and returns the answer as a
16 * string representation in `base`.
18 export default function add(a: string, b: string, base: number): string {
19 const aDigits = getDigits(a, base);
20 const bDigits = getDigits(b, base);
21 const result = addDigits(aDigits, bDigits, base);
22 return joinDigits(result, base);