This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(booleanFilter): Converted to Javascript
- Loading branch information
1 parent
7ddbd99
commit 8a7d314
Showing
2 changed files
with
20 additions
and
17 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @name Boolean filter | ||
* @description | ||
* Takes in a value and returns either true or false string | ||
*/ | ||
|
||
function booleanFactory(trueDefault, falseDefault) { | ||
return function() { | ||
return function(boolean, trueString, falseString) { | ||
trueString = trueString || trueDefault; | ||
falseString = falseString || falseDefault; | ||
return boolean ? trueString : falseString; | ||
}; | ||
}; | ||
} | ||
|
||
angular.module('Mac') | ||
.filter('boolean', booleanFactory('true', 'false')) | ||
.filter('true', booleanFactory('true', '')) | ||
.filter('false', booleanFactory('', 'false')); |