Commit 5d482b47 authored by Robert Knight's avatar Robert Knight

Add a couple of explanatory comments requested in code review

parent 01431523
......@@ -67,6 +67,7 @@ export function anchor(root, selectors, options = {}) {
let promise = Promise.reject('unable to anchor');
if (range) {
// Const binding assures TS that it won't be re-assigned when callback runs.
const range_ = range;
promise = promise.catch(() => {
let anchor = RangeAnchor.fromSelector(root, range_);
......
......@@ -16,7 +16,11 @@ import { urlFromLinkTag } from './url-from-link-tag';
* @prop {(name: string) => unknown} hostPageSetting
*/
/** @param {unknown} value */
/**
* Discard a setting if it is not a string.
*
* @param {unknown} value
*/
function checkIfString(value) {
return typeof value === 'string' ? value : null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment