New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle situation when prev and next orders are empty; fix#225 #226
Changes from 1 commit
File filter...
Jump to…
handle situation when prev and next orders are empty; fix#225
- Loading branch information
| @@ -46,11 +46,15 @@ const getPrevOrderFromNextOrder = (lastNumber, order) => { | ||
| * @param {String} nextOrder | ||
|
||
| * @returns {String} | ||
| */ | ||
| module.exports.getBookmarkOrder = (prevOrder, nextOrder) => { | ||
| module.exports.getBookmarkOrder = (prevOrder, nextOrder, parentOrder) => { | ||
| let prevOrderSplit = prevOrder.split('.') | ||
| let nextOrderSplit = nextOrder.split('.') | ||
| if (prevOrderSplit.length === 1 && nextOrderSplit.length === 1) { | ||
| throw new Error(`Invalid previous and next orders: ${prevOrderSplit} and ${nextOrderSplit}`) | ||
| if (!parentOrder) { | ||
bridiver
Contributor
|
||
| throw new Error(`Invalid previous and next orders: ${prevOrderSplit}, ${nextOrderSplit} and ${parentOrder}`) | ||
| } else { | ||
| return parentOrder + '.1'; | ||
| } | ||
| } | ||
| let order = '' | ||
| if (nextOrderSplit.length === 1) { | ||
please document parentOrder in these comments (using jsdoc)