From 1aba0ee439a79078e3d641befb979877f77ac334 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 10 Dec 2014 20:51:57 -0800 Subject: More eslint corrections. --- js/lib/from-code-point.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'js/lib/from-code-point.js') diff --git a/js/lib/from-code-point.js b/js/lib/from-code-point.js index 037c35e..69f53a2 100644 --- a/js/lib/from-code-point.js +++ b/js/lib/from-code-point.js @@ -1,8 +1,8 @@ // derived from https://github.com/mathiasbynens/String.fromCodePoint /*! http://mths.be/fromcodepoint v0.2.1 by @mathias */ if (String.fromCodePoint) { - module.exports = function (_) { + "use strict"; try { return String.fromCodePoint(_); } catch (e) { @@ -11,13 +11,14 @@ if (String.fromCodePoint) { } throw e; } - } + }; } else { var stringFromCharCode = String.fromCharCode; var floor = Math.floor; - var fromCodePoint = function(_) { + var fromCodePoint = function() { + "use strict"; var MAX_SIZE = 0x4000; var codeUnits = []; var highSurrogate; @@ -34,7 +35,7 @@ if (String.fromCodePoint) { !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` codePoint < 0 || // not a valid Unicode code point codePoint > 0x10FFFF || // not a valid Unicode code point - floor(codePoint) != codePoint // not an integer + floor(codePoint) !== codePoint // not an integer ) { return String.fromCharCode(0xFFFD); } @@ -47,7 +48,7 @@ if (String.fromCodePoint) { lowSurrogate = (codePoint % 0x400) + 0xDC00; codeUnits.push(highSurrogate, lowSurrogate); } - if (index + 1 == length || codeUnits.length > MAX_SIZE) { + if (index + 1 === length || codeUnits.length > MAX_SIZE) { result += stringFromCharCode.apply(null, codeUnits); codeUnits.length = 0; } -- cgit v1.2.3