Closed jd-solanki closed 2 years ago
I am using escodegen for my internal tooling and stuck with emoji being converted in this string. It will be great if you let me know how can I get back the emoji from those strings.
Thanks.
Take a look at the escapeless
option: https://github.com/estools/escodegen/wiki/API#optionformatescapeless
escapeless
> console.log(require('escodegen').generate(require('esprima').parse(`const satisfactionEmojis = ['đ', 'đĸ', 'âšī¸', 'đ', 'đ', 'đ', 'đ', 'đ', 'đ', 'đ']`)));
const satisfactionEmojis = [
'\uD83D\uDE2D',
'\uD83D\uDE22',
'\u2639ī¸',
'\uD83D\uDE41',
'\uD83D\uDE10',
'\uD83D\uDE42',
'\uD83D\uDE0A',
'\uD83D\uDE01',
'\uD83D\uDE04',
'\uD83D\uDE0D'
];
escapeless
> console.log(require('escodegen').generate(require('esprima').parse(`const satisfactionEmojis = ['đ', 'đĸ', 'âšī¸', 'đ', 'đ', 'đ', 'đ', 'đ', 'đ', 'đ']`), {format: {escapeless: true}}));
const satisfactionEmojis = [
'đ',
'đĸ',
'âšī¸',
'đ',
'đ',
'đ',
'đ',
'đ',
'đ',
'đ'
];
That made my day â¤ī¸
Thanks
Assume I have the below code:
When I paste them in your online tool it is generating string like below:
not the emoji.
How can I get back the emojies?