File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 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) {
7878
7979exports . _fromCodePointArray = function ( singleton ) {
8080 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+ }
8387 : function ( cps ) { return cps . map ( singleton ) . join ( "" ) ; } ;
8488} ;
8589
Original file line number Diff line number Diff line change @@ -66,11 +66,6 @@ testStringCodePoints = do
6666 assert $ indexOf (Pattern " z" ) str == Just 6
6767 assert $ indexOf (Pattern " \0" ) str == Nothing
6868 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
7469
7570 log " indexOf'"
7671 assert $ indexOf' (Pattern " " ) 0 " " == Just 0
You can’t perform that action at this time.
0 commit comments