File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 814
814
// remove IE `shift` and `splice` fix from mutator Array functions mixin
815
815
source = source . replace ( / (?: \s * \/ \/ .* ) * \n ( + ) i f * \( v a l u e .l e n g t h * = = = * 0 [ \s \S ] + ?\n \1} / , '' ) ;
816
816
817
- // remove `noCharByIndex` from `_.reduceRight` and `_.toArray`
817
+ // remove `noCharByIndex` from `_.reduceRight`
818
818
source = source . replace ( / n o C h a r B y I n d e x * & & [ ^ : ] + : * ( [ ^ ; ] + ) / g, '$1' ) ;
819
819
820
820
source = removeVar ( source , 'extendIteratorOptions' ) ;
Original file line number Diff line number Diff line change 129
129
var hasDontEnumBug = ! propertyIsEnumerable . call ( { 'valueOf' : 0 } , 'valueOf' ) ;
130
130
131
131
/**
132
- * Detect support for accessing string characters by index:
132
+ * Detect lack of support for accessing string characters by index:
133
133
* IE < 8 can't access characters by index and IE 8 can only access
134
134
* characters by index on string literals.
135
135
*/
136
136
var noCharByIndex = ( 'x' [ 0 ] + Object ( 'x' ) [ 0 ] ) != 'xx' ;
137
137
138
+ /** Detect if `Array#slice` cannot be used to convert strings to arrays (e.g. Opera < 10.52) */
139
+ var noArraySliceOnStrings = slice . call ( 'x' ) [ 0 ] != 'x' ;
140
+
138
141
/* Detect if `Function#bind` exists and is inferred to be fast (i.e. all but V8) */
139
142
var isBindFast = nativeBind && / \n | O p e r a / . test ( nativeBind + toString . call ( window . opera ) ) ;
140
143
727
730
'beforeLoop' : {
728
731
'array' : 'if (toString.call(iteratee) == stringClass) return collection.indexOf(target) > -1'
729
732
} ,
730
- 'inLoop' : 'if (iteratee[index] === target) return true' ,
733
+ 'inLoop' : 'if (iteratee[index] === target) return true'
731
734
} ) ;
732
735
733
736
/**
1171
1174
}
1172
1175
var length = collection . length ;
1173
1176
if ( length === length >>> 0 ) {
1174
- return noCharByIndex && toString . call ( collection ) == stringClass
1177
+ return ( noArraySliceOnStrings ? toString . call ( collection ) == stringClass : typeof collection == 'string' )
1175
1178
? collection . split ( '' )
1176
1179
: slice . call ( collection ) ;
1177
1180
}
Original file line number Diff line number Diff line change 872
872
873
873
/*--------------------------------------------------------------------------*/
874
874
875
+ suites . push (
876
+ Benchmark . Suite ( '`_.toArray` with an array' )
877
+ . add ( 'Lo-Dash' , function ( ) {
878
+ lodash . toArray ( numbers ) ;
879
+ } )
880
+ . add ( 'Underscore' , function ( ) {
881
+ _ . toArray ( numbers ) ;
882
+ } )
883
+ ) ;
884
+
885
+ suites . push (
886
+ Benchmark . Suite ( '`_.toArray` with an object' )
887
+ . add ( 'Lo-Dash' , function ( ) {
888
+ lodash . toArray ( object ) ;
889
+ } )
890
+ . add ( 'Underscore' , function ( ) {
891
+ _ . toArray ( object ) ;
892
+ } )
893
+ ) ;
894
+
895
+ /*--------------------------------------------------------------------------*/
896
+
875
897
suites . push (
876
898
Benchmark . Suite ( '`_.union`' )
877
899
. add ( 'Lo-Dash' , function ( ) {
You can’t perform that action at this time.
0 commit comments