diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-10 20:51:57 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-10 20:51:57 -0800 |
commit | 1aba0ee439a79078e3d641befb979877f77ac334 (patch) | |
tree | eb3585048e327aeaf5910b79e3b5b779834b6cd6 /js/lib | |
parent | 5fbd73cc31627b125c59f98a5de41e6442235ea7 (diff) |
More eslint corrections.
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/from-code-point.js | 11 |
1 files changed, 6 insertions, 5 deletions
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; } |