File tree 2 files changed +6
-7
lines changed
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,12 @@ exports._count = function (isLead) {
78
78
79
79
exports . _fromCodePointArray = function ( singleton ) {
80
80
return hasFromCodePoint
81
- // TODO: using F.p.apply here will fail for very large strings; use alternative implementation for very large strings
82
- ? function ( cps ) { return String . fromCodePoint . apply ( String , cps ) ; }
81
+ ? function ( cps ) {
82
+ if ( cps . length < 10240 ) {
83
+ return String . fromCodePoint . apply ( String , cps ) ;
84
+ }
85
+ return cps . map ( singleton ) . join ( "" ) ;
86
+ }
83
87
: function ( cps ) { return cps . map ( singleton ) . join ( "" ) ; } ;
84
88
} ;
85
89
Original file line number Diff line number Diff line change @@ -66,11 +66,6 @@ testStringCodePoints = do
66
66
assert $ indexOf (Pattern " z" ) str == Just 6
67
67
assert $ indexOf (Pattern " \0" ) str == Nothing
68
68
assert $ indexOf (Pattern " \xD81A " ) str == Just 4
69
- -- TODO: Should this be Nothing? It matches the trail surrogate of a surrogate pair.
70
- -- It'd be nice if (drop (indexOf pattern str) str) was guaranteed to start with pattern.
71
- -- If we change this, we'll also need to add a matching contains implementation to the CodePoints module.
72
- -- I vote we just delete the test. Passing surrogate halves to the CodePoints functions should not be supported.
73
- assert $ indexOf (Pattern " \xDC05 " ) str == Just 5
74
69
75
70
log " indexOf'"
76
71
assert $ indexOf' (Pattern " " ) 0 " " == Just 0
You can’t perform that action at this time.
0 commit comments