MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / createPointAt

Function createPointAt

lib/web/polyfill.js:326–338  ·  view source on GitHub ↗
(toString)

Source from the content-addressed store, hash-verified

324 }
325}
326function createPointAt(toString){
327 return function(pos){
328 var s = String(assertDefined(this))
329 , i = toInteger(pos)
330 , l = s.length
331 , a, b;
332 if(i < 0 || i >= l)return toString ? '' : undefined;
333 a = s.charCodeAt(i);
334 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
335 ? toString ? s.charAt(i) : a
336 : toString ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
337 }
338}
339
340// Assertion & errors
341var REDUCE_ERROR = 'Reduce of empty object with no initial value';

Callers 1

polyfill.jsFile · 0.85

Calls 2

assertDefinedFunction · 0.85
toIntegerFunction · 0.85

Tested by

no test coverage detected