1- var hasArrayFrom = typeof Array . from === 'function' ;
1+ "use strict" ;
2+ /* global Symbol */
3+
4+ var hasArrayFrom = typeof Array . from === "function" ;
25var hasStringIterator =
3- typeof Symbol !== ' undefined' &&
6+ typeof Symbol !== " undefined" &&
47 Symbol != null &&
5- typeof Symbol . iterator !== 'undefined' &&
6- typeof String . prototype [ Symbol . iterator ] === 'function' ;
7- var hasFromCodePoint = typeof String . prototype . fromCodePoint === 'function' ;
8- var hasCodePointAt = typeof String . prototype . codePointAt === 'function' ;
8+ typeof Symbol . iterator !== "undefined" &&
9+ typeof String . prototype [ Symbol . iterator ] === "function" ;
10+ var hasFromCodePoint = typeof String . prototype . fromCodePoint === "function" ;
11+ var hasCodePointAt = typeof String . prototype . codePointAt === "function" ;
12+
13+ function fromCodePoint ( cp ) {
14+ if ( cp <= 0xFFFF ) return String . fromCharCode ( cp ) ;
15+ var cu1 = String . fromCharCode ( Math . floor ( ( cp - 0x10000 ) / 0x400 ) + 0xD800 ) ;
16+ var cu2 = String . fromCharCode ( ( cp - 0x10000 ) % 0x400 + 0xDC00 ) ;
17+ return cu1 + cu2 ;
18+ }
919
1020exports . _codePointAt = function ( fallback ) {
1121 return function ( Just ) {
@@ -23,7 +33,7 @@ exports._codePointAt = function (fallback) {
2333 for ( var i = index ; ; -- i ) {
2434 var o = iter . next ( ) ;
2535 if ( o . done ) return Nothing ;
26- if ( i == 0 ) return Just ( o . value ) ;
36+ if ( i === 0 ) return Just ( o . value ) ;
2737 }
2838 }
2939 return fallback ( index ) ( str ) ;
@@ -61,15 +71,15 @@ exports._count = function (isLead) {
6171
6272exports . fromCodePointArray = hasFromCodePoint
6373 ? function ( cps ) { return String . fromCodePoint . apply ( String , cps ) ; }
64- : function ( cps ) { return cps . map ( fromCodePoint ) . join ( '' ) ; } ;
74+ : function ( cps ) { return cps . map ( fromCodePoint ) . join ( "" ) ; } ;
6575
6676exports . singleton = hasFromCodePoint ? String . fromCodePoint : fromCodePoint ;
6777
6878exports . _take = function ( fallback ) {
6979 return function ( n ) {
7080 if ( hasArrayFrom ) {
7181 return function ( str ) {
72- return Array . from ( str ) . slice ( 0 , Math . max ( 0 , n ) ) . join ( '' ) ;
82+ return Array . from ( str ) . slice ( 0 , Math . max ( 0 , n ) ) . join ( "" ) ;
7383 } ;
7484 } else if ( hasStringIterator ) {
7585 return function ( str ) {
@@ -105,10 +115,3 @@ exports._toCodePointArray = function (fallback) {
105115 }
106116 return fallback ;
107117} ;
108-
109- function fromCodePoint ( cp ) {
110- if ( cp <= 0xFFFF ) return String . fromCharCode ( cp ) ;
111- var cu1 = String . fromCharCode ( Math . floor ( ( cp - 0x10000 ) / 0x400 ) + 0xD800 ) ;
112- var cu2 = String . fromCharCode ( ( cp - 0x10000 ) % 0x400 + 0xDC00 ) ;
113- return cu1 + cu2 ;
114- }
0 commit comments