filterBy not distinguish positive and negative number
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- angular, javascript
- Domain
- frontend
Research direction
The issue is in the filterBy function of angular-filter. Look at the source code for the filterBy implementation, likely in a file like angular-filter.js or a specific filter module. The bug is that numeric comparison treats 1 and -1 as equal. Examine the comparison logic, likely using loose equality or absolute value. Write a test to reproduce the issue with an array [1, -1, 3, 5] and filter value 1, expecting only [1]. Modify the comparison to distinguish positive and negative numbers. Check existing tests for filterBy to ensure changes don't break other functionality.
Written by the indexing model from the issue text.
Description
Considering this code
block in orderjson.Blocks | filterBy: ['ID_Block']: block_NM.ID_Block
if ID_Block have on array values [1, -1,3,5] and filter is set to 1.
I expect to print just first value, but filter print also -1 because comparision consider 1,-1 the same.
On the flipside of the coin, using only positive values it works fine (no duplicates).
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 319
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from a8m/angular-filter
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
a8m/angular-filter#267 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
a8m/angular-filter#260 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a8m/angular-filter#254 · 2 comments · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a8m/angular-filter#250 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a8m/angular-filter#208 · 1 comment · 1 reaction ·
All issues in a8m/angular-filter
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·