Sha256: 1c842be8c1c6e83e08b4d9254e7d22af51ca930fe5a5fca5e1e703a9525100e2

Contents?: true

Size: 622 Bytes

Versions: 22

Compression:

Stored size: 622 Bytes

Contents

var decodeMap = require("../maps/decode.json");

module.exports = decodeCodePoint;

// modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
function decodeCodePoint(codePoint){

	if((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF){
		return "\uFFFD";
	}

	if(codePoint in decodeMap){
		codePoint = decodeMap[codePoint];
	}

	var output = "";

	if(codePoint > 0xFFFF){
		codePoint -= 0x10000;
		output += String.fromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
		codePoint = 0xDC00 | codePoint & 0x3FF;
	}

	output += String.fromCharCode(codePoint);
	return output;
}

Version data entries

22 entries across 19 versions & 5 rubygems

Version Path
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/entities/lib/decode_codepoint.js
locomotivecms-3.4.0 app/javascript/node_modules/entities/lib/decode_codepoint.js
lanes-0.8.0 node_modules/entities/lib/decode_codepoint.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.10 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.9 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.8 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.7 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.6 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.5 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.4 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.3 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.2 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.1 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/entities/lib/decode_codepoint.js