MCPcopy
hub / github.com/jquery/esprima / generate

Function generate

tools/generate-xhtml-entities.js:59–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57}
58
59function generate() {
60 var entities = {};
61
62 function cp(n) {
63 var str = n.toString(16).toUpperCase();
64 while (str.length < 4) {
65 str = '0' + str;
66 }
67 return '\'\\u' + str + '\'';
68 }
69
70 collect(function (data) {
71 var codes = [], lines = [];
72
73 data.sort(function (p, q) {
74 return p.code - q.code;
75 });
76 data.forEach(function (u) {
77 if (codes.indexOf(u.code) < 0) {
78 lines.push(' ' + u.name + ': ' + cp(u.code));
79 }
80 codes.push(u.code);
81 });
82 console.log('// Generated by generate-xhtml-entities.js. DO NOT MODIFY!');
83 console.log();
84 console.log('export const XHTMLEntities = {');
85 console.log(lines.join(',\n'));
86 console.log('};');
87 console.log();
88 });
89}
90
91generate();

Callers 1

Calls 3

cpFunction · 0.85
pushMethod · 0.80
collectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…