Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
url: (asset) => {
// TODO pass in request URL and make it absolute.
if (asset.search === '' && asset.absolutePath !== '.' && asset.relativePath !== '.') {
return `${asset.relativePath}`;
}
return asset.url;
},
}));
function resolveUrl(baseId, id) {
id = normalizeId(id);
return URI.resolve(baseId, id);
}
response.links = $('a').map(function() {
var href = $(this).attr('href');
if (href && href.trim().length && href[0] !== "#") {
return URI.resolve(url, href);
} else {
return 0;
}
}).filter(function(i, item) {
if (item === 0) {
function resolveUrl(baseId, id) {
id = normalizeId(id);
return URI.resolve(baseId, id);
}
}
}
response.uri = uri;
if (options.title) {
response.title = metaData['og:title'] || title;
}
if (options.description) {
response.description = metaData['og:description'] || metaData.description;
}
if (options.type) {
response.type = metaData['og:type'];
}
if (options.url) {
response.url = URI.resolve(url, canonicalURL || metaData['og:url'] || url);
response.originalURL = url;
response.ampURL = ampURL || null;
}
if (options.siteName) {
response.siteName = metaData['og:site_name'];
}
if (options.image) {
response.image = metaData['og:image'];
}
if (options.meta) {
response.meta = metaData;
}
if (options.headers) {
response.headers = header;
}
return response;
if (importuri.reference === 'relative' && !importuri.query) {
rule.replaceWith(postcss.atRule({
name: 'import',
params: `url(${quote}${importuri.path}${quote}) ${queries}`,
}));
}
} else if (parsedurl.nodes
&& parsedurl.nodes[0].type === 'string'
&& typeof parsedurl.nodes[0].value === 'string'
&& typeof parsedurl.nodes[0].quote === 'string') {
const importuri = uri.parse(parsedurl.nodes[0].value);
const { quote } = parsedurl.nodes[0];
if (importuri.reference === 'relative' && !importuri.query) {
rule.replaceWith(postcss.atRule({
name: 'import',
params: `${quote}${importuri.path}${quote} ${queries}`,
}));
}
}
}
});
return tree;
response.images = $('img').map(function() {
var src = $(this).attr('src');
if (src) {
return URI.resolve(url, src);
} else {
return "";
}
}).filter(function(e, f) {
return (f.match(/\.(jpeg|jpg|gif|png|JPEG|JPG|GIF|PNG)$/) !== null);