filterBy on boolean is not working

Open Beginner friendly
#208 1 comment 1 reaction 0 assignees View on GitHub

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
angularjs, javascript
Domain
frontend

Research direction

The issue points to the filter-by.js source file, line 14, where the search value is only processed if it's a string or number. To fix, modify the condition to also handle boolean values. Test by creating a collection with boolean properties and using the filterBy filter to ensure it works correctly. Check existing tests for filter-by to see if any need updating.

Written by the indexing model from the issue text.

Description

Filtering on a boolean property has no effect at all.
Example: $filter('filterBy')(collection, ['property'], true)

Looking at the source we can see that only string and number are allowed.
Line 14: search = (isString(search) || isNumber(search)) ? String(search).toLowerCase() : undefined;

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from a8m/angular-filter

All issues in a8m/angular-filter

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.