Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should work with high code points', done => {
const svgIconStream = fs.createReadStream(
path.join(__dirname, 'fixtures', 'cleanicons', 'account.svg')
);
const svgFontStream = new SVGIcons2SVGFontStream({ round: 1e3 });
let content = '';
const decoder = new StringDecoder('utf8');
svgIconStream.metadata = {
name: 'account',
unicode: [ucs2.encode([0x1f63a])],
};
svgFontStream.on('data', chunk => {
content += decoder.write(chunk);
});
svgFontStream.on('finish', () => {
assert.equal(
content,
fs.readFileSync(
path.join(__dirname, 'expected', 'cleanicons-high.svg'),
{ encoding: 'utf8' }
)
);
done();
});
const getEmojiFlag = (countryCode) => {
if (!COUNTRY_CODE_REGEX.test(countryCode)) {
return '';
}
return ucs2.encode(
countryCode
.split('')
.map(letter => UNICODE_BASE + letter.charCodeAt(0))
);
};
const getEmojiFlag = (countryCode) => {
if (!COUNTRY_CODE_REGEX.test(countryCode)) {
return '';
}
return ucs2.encode(
countryCode
.split('')
.map(letter => UNICODE_BASE + letter.charCodeAt(0))
);
};