function extract(pointer, obj) {
  const tokens = jsonPointerToArray(pointer);
  if (tokens.length < 1) {
    return obj;
  }

  const val = lib.getIn(obj, tokens);
  if (typeof val === 'undefined') {
    throw new JSONRefError(`Could not resolve pointer: ${pointer} does not exist in document`, {
      pointer,
    });
  }
  return val;
}
Extracts a pointer from an object.
@param  {String[]} pointer the JSON pointer.
@param  {Object} obj       an object whose value is to be extracted.
@return {Object}           the value to be extracted.
@api public