Skip to content

Commit

Permalink
Core Data: Check for nullity in experimental fetch methods
Browse files Browse the repository at this point in the history
Adds a nullity check and enhances a JSDoc comment to acknowledge
the nullable presence of a property in an object we test.
  • Loading branch information
dmsnell authored and adamziel committed Mar 16, 2022
1 parent 19d45c3 commit eec7411
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const fetchLinkSuggestions = async (
.slice( 0, perPage )
.map(
/**
* @param {{ id: number, url:string, title?:string, subtype?: string, type?: string }} result
* @param {{ id: number, meta?: object, url:string, title?:string, subtype?: string, type?: string }} result
*/
( result ) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const fetchUrlData = async ( url, options = {} ) => {
const protocol = getProtocol( url );

if (
! protocol ||
! isValidProtocol( protocol ) ||
! protocol.startsWith( 'http' ) ||
! /^https?:\/\/[^\/\s]/i.test( url )
Expand Down

0 comments on commit eec7411

Please sign in to comment.