Skip to content

Instantly share code, notes, and snippets.

View leyayun's full-sized avatar
๐ŸŽฏ
Focusing

Aaron Lee leyayun

๐ŸŽฏ
Focusing
  • Shanghai,China
View GitHub Profile
@leyayun
leyayun / task.js
Created April 5, 2019 02:07
ๅฎไปปๅŠกไธŽๅพฎไปปๅŠก
console.log(1)
setTimeout(function(){
console.log(2)
}, 200)
async function fn() {
console.log(3)
await Promise.resolve()
console.log(4)
@leyayun
leyayun / gist:05505edb02137b97d53f5d1d2451505b
Created December 14, 2017 03:49 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: ๐Ÿ˜„ :smile: ๐Ÿ˜† :laughing:
๐Ÿ˜Š :blush: ๐Ÿ˜ƒ :smiley: โ˜บ๏ธ :relaxed:
๐Ÿ˜ :smirk: ๐Ÿ˜ :heart_eyes: ๐Ÿ˜˜ :kissing_heart:
๐Ÿ˜š :kissing_closed_eyes: ๐Ÿ˜ณ :flushed: ๐Ÿ˜Œ :relieved:
๐Ÿ˜† :satisfied: ๐Ÿ˜ :grin: ๐Ÿ˜‰ :wink:
๐Ÿ˜œ :stuck_out_tongue_winking_eye: ๐Ÿ˜ :stuck_out_tongue_closed_eyes: ๐Ÿ˜€ :grinning:
๐Ÿ˜— :kissing: ๐Ÿ˜™ :kissing_smiling_eyes: ๐Ÿ˜› :stuck_out_tongue:
// ๅญ—็ฌฆไธฒๆจกๆฟๆ›ฟๆข
String.prototype.render = function(obj) {
var regex = /\$\{\w+(.\w+)*\}/g;
var matches = this.match(regex);
return this.replace(regex, function() {
var atts = arguments[0].slice(2, arguments[0].length - 1).split('.');
var value = JSON.parse(JSON.stringify(obj));
for(var i=0; i < atts.length; i++) {
value = value[atts[i]];
}