MCPcopy Create free account
hub / github.com/reactjs/react-rails / utf8Slice

Function utf8Slice

lib/assets/javascripts/JSXTransformer.js:928–943  ·  view source on GitHub ↗
(buf, start, end)

Source from the content-addressed store, hash-verified

926}
927
928function utf8Slice (buf, start, end) {
929 var res = ''
930 var tmp = ''
931 end = Math.min(buf.length, end)
932
933 for (var i = start; i < end; i++) {
934 if (buf[i] <= 0x7F) {
935 res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
936 tmp = ''
937 } else {
938 tmp += '%' + buf[i].toString(16)
939 }
940 }
941
942 return res + decodeUtf8Char(tmp)
943}
944
945function asciiSlice (buf, start, end) {
946 var ret = ''

Callers 1

JSXTransformer.jsFile · 0.85

Calls 1

decodeUtf8CharFunction · 0.85

Tested by

no test coverage detected