Sha256: 66ab0e69f5e3cf5abe2cd8b654efefeb7a181382ba20ea466b8bc4aa8788758f

Contents?: true

Size: 245 Bytes

Versions: 10

Compression:

Stored size: 245 Bytes

Contents

Number.prototype.to_hex = function() {
	if (this === 0) {
		return "00";
	}

	var chars = "0123456789ABCDEF";
	var n = Math.max(0, this);
	n = Math.min(n, 255);
	n = Math.round(n);
	return chars.charAt((n - n % 16)/16) + chars.charAt(n % 16);
};

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
ninjs-0.16.8 repository/ninjs/utilities/number.js
ninjs-0.16.7 repository/ninjs/utilities/number.js
ninjs-0.16.6 repository/ninjs/utilities/number.js
ninjs-0.16.5 repository/ninjs/utilities/number.js
ninjs-0.16.4 repository/ninjs/utilities/number.js
ninjs-framework-0.1.0 lib/ninjs-framework/utilities/number.js
ninjs-0.16.3 repository/ninjs/utilities/number.js
ninjs-0.16.2 repository/ninjs/utilities/number.js
ninjs-0.16.1 repository/ninjs/utilities/number.js
ninjs-0.16.0 repository/ninjs/utilities/number.js