MCPcopy
hub / github.com/fontello/fontello / findPrivateUseArea

Function findPrivateUseArea

client/fontello/models/_lib/codes_tracker.js:88–105  ·  view source on GitHub ↗
(preferredCode)

Source from the content-addressed store, hash-verified

86// Returns first available and valid code in the Unicode Private Use Area.
87//
88function findPrivateUseArea(preferredCode) {
89 if (preferredCode &&
90 checkValidCode(preferredCode) &&
91 !usedCodes[preferredCode] &&
92 preferredCode >= UNICODE_PRIVATE_USE_AREA_MIN &&
93 preferredCode <= UNICODE_PRIVATE_USE_AREA_MAX) {
94 return preferredCode;
95 }
96
97 var code = findCode(UNICODE_PRIVATE_USE_AREA_MIN, UNICODE_PRIVATE_USE_AREA_MAX);
98
99 if (code !== -1) {
100 return code;
101 }
102
103 // Should never happen.
104 throw new Error('Free glyph codes in the Private Use Area are run out.');
105}
106
107
108// Returns first available and valid printable ASCII code.

Callers 3

findAsciiFunction · 0.85
findUnicodeFunction · 0.85
allocateCodeFunction · 0.85

Calls 2

checkValidCodeFunction · 0.85
findCodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…