Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function each(node) {
var name = q.select('[title="Name"]', node)
var elements = q.select('[title="Related Elements"]', node)
if (!name || !elements) {
return
}
name = trim(toString(name))
elements = toString(elements)
if (!name || ev(name)) {
return
}
if (/All elements/.test(elements)) {
elements = ['*']
} else {
function each(node) {
var name = q.select('[title="Name"]', node)
var elements = q.select('[title="Related Elements"]', node)
if (!name || !elements) {
return
}
name = trim(toString(name))
elements = toString(elements)
if (!name || ev(name)) {
return
}
if (/All elements/.test(elements)) {
elements = ['*']
} else {
elements = elements.split(/,/g)
function onemoji(err, res, body) {
bail(err)
var tree = proc.parse(body)
var related = query.selectAll('.emoji-list > li > a', tree)
var emoji = query.select('#emoji-copy', tree).properties.value
var title = query.select('h1', tree)
var id = query
.select('[property="og:url"]', tree)
.properties.content.slice(1, -1)
var entry = {
id: id,
title: collapse(toString(title.children[title.children.length - 1])).trim(),
platforms: []
}
data[emoji] = entry
debug('Emoji: %s (%s, %s)', entry.id, emoji, entry.title)
query
.selectAll('.vendor-list > ul > li > .vendor-container', tree)
.forEach(one)
function oncategory(err, res, body) {
bail(err)
var tree = proc.parse(body)
debug('Category: %s', collapse(toString(query.select('h1', tree))).trim())
query.selectAll('.emoji-list a', tree).forEach(get)
}
function each(node) {
q.selectAll('.element', node)
.map(toString)
.forEach(add(map, toString(q.select('.attribute-name', node))))
}
}
function onemoji(err, res, body) {
bail(err)
var tree = proc.parse(body)
var related = query.selectAll('.emoji-list > li > a', tree)
var emoji = query.select('#emoji-copy', tree).properties.value
var title = query.select('h1', tree)
var id = query
.select('[property="og:url"]', tree)
.properties.content.slice(1, -1)
var entry = {
id: id,
title: collapse(toString(title.children[title.children.length - 1])).trim(),
platforms: []
}
data[emoji] = entry
debug('Emoji: %s (%s, %s)', entry.id, emoji, entry.title)
query
.selectAll('.vendor-list > ul > li > .vendor-container', tree)
function one(node) {
var platform = collapse(toString(query.select('.vendor-info', node))).trim()
var img = query.select('.vendor-image img', node).properties.src
var pid = platform.toLowerCase().replace(/\s+/g, '')
var dir = path.join('src', 'image', pid)
entry.platforms.push(pid)
if (!(pid in platforms)) {
platforms[pid] = platform
try {
fs.mkdirSync(dir)
} catch (error) {
if (error.code !== 'EEXIST') {
bail(error)
}
}
}
function one(node) {
var platform = collapse(toString(query.select('.vendor-info', node))).trim()
var img = query.select('.vendor-image img', node).properties.src
var pid = platform.toLowerCase().replace(/\s+/g, '')
var dir = path.join('src', 'image', pid)
entry.platforms.push(pid)
if (!(pid in platforms)) {
platforms[pid] = platform
try {
fs.mkdirSync(dir)
} catch (error) {
if (error.code !== 'EEXIST') {
bail(error)
}
}
function onconcat(buf) {
var dl = q.select('#elements-2 ~ dl dd', proc.parse(buf))
q.selectAll('code', dl).forEach(each)
fs.writeFile('index.json', JSON.stringify(list.sort(), 0, 2) + '\n', bail)
}
function onemoji(err, res, body) {
bail(err)
var tree = proc.parse(body)
var related = query.selectAll('.emoji-list > li > a', tree)
var emoji = query.select('#emoji-copy', tree).properties.value
var title = query.select('h1', tree)
var id = query
.select('[property="og:url"]', tree)
.properties.content.slice(1, -1)
var entry = {
id: id,
title: collapse(toString(title.children[title.children.length - 1])).trim(),
platforms: []
}
data[emoji] = entry
debug('Emoji: %s (%s, %s)', entry.id, emoji, entry.title)
query
.selectAll('.vendor-list > ul > li > .vendor-container', tree)
.forEach(one)