Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A.dropWhile is completely broken #101

Open
ivan-kleshnin opened this issue Jan 25, 2024 · 1 comment · May be fixed by #103
Open

A.dropWhile is completely broken #101

ivan-kleshnin opened this issue Jan 25, 2024 · 1 comment · May be fixed by #103

Comments

@ivan-kleshnin
Copy link

ivan-kleshnin commented Jan 25, 2024

A.dropWhile drops ALL items matching the predicate. It behaves exactly like A.reject:

import {A,D} from "@mobily/ts-belt"

console.log(
  A.dropWhile([0 ,           1, 0, 0, 0], (x) => x == 0),       // should drop the first zero
  A.reject   ([0 ,           1, 0, 0, 0], (x) => x == 0),       // should drop all zeros
  A.dropWhile([{},{foo: "Bar"},{},{},{}], (x) => D.isEmpty(x)), // should drop the first empty obj
  A.reject([{},{foo: "Bar"},{},{},{}], (x) => D.isEmpty(x)),    // should drop all empty objs
)
[ 1 ] // dropWhile, expected [ 1, 0, 0, 0 ]
[ 1 ] // reject
[ { foo: 'Bar' } ] // dropWhile, expected [ { foo: 'Bar' }, {}, {}, {} ]
[ { foo: 'Bar' } ] // reject
@JUSTIVE JUSTIVE linked a pull request Feb 9, 2024 that will close this issue
@JUSTIVE
Copy link

JUSTIVE commented Mar 11, 2024

Hi. I made a PR to resolve this issue. please have a look and let me know if it's right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants