Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
refactor(booleanFilter): Converted to Javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlee44 committed Feb 15, 2015
1 parent 7ddbd99 commit 8a7d314
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/filters/boolean.coffee

This file was deleted.

20 changes: 20 additions & 0 deletions src/filters/boolean.js
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'));

0 comments on commit 8a7d314

Please sign in to comment.