-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding packaged files for release to bower
- Loading branch information
Chris Conolly
committed
Oct 27, 2015
1 parent
9b71262
commit eb064f2
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
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,24 @@ | ||
/* global angular */ | ||
|
||
angular | ||
.module('ordinal', []) | ||
.factory('ordinalService', function () { | ||
var ordinal = function (input) { | ||
var n = input % 100; | ||
return n === 0 ? 'th' : (n < 11 || n > 13) ? | ||
['st', 'nd', 'rd', 'th'][Math.min((n - 1) % 10, 3)] : 'th'; | ||
}; | ||
return { | ||
ordinal: ordinal | ||
}; | ||
}) | ||
.filter('ordinal', ['ordinalService', function (ordinalService) { | ||
return function (input) { | ||
return input + ordinalService.ordinal(input); | ||
}; | ||
}]) | ||
.filter('ordinalOnly', ['ordinalService', function (ordinalService) { | ||
return function (input) { | ||
return ordinalService.ordinal(input); | ||
}; | ||
}]); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.