Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const addAssetToLoad = ( assets, url, usages ) => {
// Remove resizing query arguments from the URL.
url = removeQueryArgs( url, 'w', 's' );
// Use an existing asset for the URL or make a new one.
const asset = assets[ url ] || {
url,
usages: [],
};
// Return new result object, extended with the new/updated asset.
return {
...assets,
[ url ]: {
...asset,
// Store where exactly block uses id/url so we can update it later.
usages: [ ...asset.usages, ...usages ],
},
};
removeAmpQueryVars( url ) {
return removeQueryArgs( url, ampSlug, ampPairedBrowsingQueryVar, ampValidationErrorsQueryVar );
}
const removeWindowHistory = ( keys, queryStateContext ) => {
if ( hasWindowDependencies ) {
keys = keys.map( ( key ) => `${ key }_${ queryStateContext }` );
const existingUrl = window.location.href;
const newUrl = removeQueryArgs( window.location.href, ...keys );
if ( newUrl !== existingUrl ) {
window.history.pushState( null, '', newUrl );
}
}
};
{ templates.map( template => (
selectLayout( template ) }
key={ template.slug }
>
<div>
</div>
<img src="{" alt="{">
) ) }
const DesignCard: FunctionComponent< Props > = ( { design, onClick, isSelected, style } ) => (
<img srcset="{" src="{" alt="{" height="{" width="{">
);