File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -455,17 +455,15 @@ export function bit_array_split_once(bits, pattern) {
455455
456456export function bit_array_split ( bits , pattern ) {
457457 try {
458- if ( ! ( bits instanceof BitArray )
459- || ! ( pattern instanceof BitArray )
460- || pattern . buffer . length < 1 ) {
458+ const patternEmpty = pattern . buffer . length < 1
459+ const incorrectArguments = ! ( bits instanceof BitArray ) || ! ( pattern instanceof BitArray )
460+ if ( incorrectArguments || patternEmpty ) {
461461 return new Error ( Nil ) ;
462462 }
463463
464- if ( bits . buffer . length === 0 ) {
465- return new Ok ( List . fromArray ( [ ] ) ) ;
466- }
467-
468- if ( Buffer . compare ( bits . buffer , pattern . buffer ) === 0 ) {
464+ const bitsEqualToPattern = Buffer . compare ( bits . buffer , pattern . buffer ) === 0
465+ const bitsEmpty = bits . buffer . length === 0
466+ if ( bitsEqualToPattern || bitsEmpty ) {
469467 return new Ok ( List . fromArray ( [ ] ) ) ;
470468 }
471469
You can’t perform that action at this time.
0 commit comments