Name: bedrock-angular-filters
Owner: Digital Bazaar, Inc.
Description: Bedrock AngularJS Filters
Created: 2015-01-20 23:20:06.0
Updated: 2017-09-09 01:37:47.0
Pushed: 2017-05-30 16:23:47.0
Homepage: null
Size: 29
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A bedrock bower module that implements various AngularJS filters.
show a readable byte count -->
>Download size: {{downloadSize | bytes}}</div>
mask a credit card number -->
>Card number: {{cardNumber | mask}}</div>
r install bedrock-angular-filters
Installation of the module followed by a restart of your bedrock server is sufficient to make the module and filters available to your application.
To manually add bedrock-angular-filters as a dependency:
lar.module('myapp', ['bedrock.filters']);
Humanize a number into a readable quantity of bytes.
MBER | bytes[:PRECISION]}}
Options:
1
).34 | bytes}} => '1.2 KiB'
3456 | bytes}} => '120.6 KiB'
34567890 | bytes}} => '1.1 GiB'
3456789012345 | bytes}} => '112.3 TiB'
3456789012345678 | bytes}} => '109.7 PiB'
3456789012345678 | bytes:3}} => '109.652 PiB'
Perform a Math.ceil
operation on a string number.
RING_NUMBER | ceil[:DIGITS]}}
Options:
2
)..123' | ceil}} => '1.13'
.991' | ceil}} => '1.00'
.991' | ceil:4}} => '0.9910'
Limit the length of a string and show ellipsis if needed.
RING | ellipsis[:LENGTH]}}
Options:
bcdefg' | ellipsis:10}} => 'abcdefg'
bcdefg' | ellipsis:6}} => 'abc...'
bcdefg' | ellipsis:1}} => '...'
Replace carriage return (0x0d) with \r
(0x5c 0x72) and newline (0x0a) with
\n
(0x5c 0x63).
RING | embeddedString}}
lti_line_string | embeddedString}} => 'abc\r\ndef'
Process a string with encodeURIComponent
.
RING | encodeuricomponent}}
ttp://foo.bar?baz=fuzz' | encodeuricomponent}} => 'http%3A%2F%2Ffoo.bar%3Fbaz%3Dfuzz'
Perform a Math.floor
operation on a string number.
RING_NUMBER | floor[:DIGITS]}}
Options:
2
)..123' | floor}} => '1.12'
.991' | floor:3}} => '0.991'
.991' | floor:4}} => '0.9910'
Check if a string, array, or object is empty.
LUE | isEmpty}}
| isEmpty}} => true
234' | isEmpty}} => false
| isEmpty}} => true
234] | isEmpty}} => false
| isEmpty}} => true
value': 1234} | isEmpty}} => false
Show only the 4 final characters of a string and mask the rest.
RING | mask[:LENGTH]}}
Options:
5
).2345' | mask}} => '*2345'
2345' | mask:4}} => '2345'
2345' | mask:8}} => '****2345'
Filter the current date and time through the date
filter.
| now:FORMAT}}
Options:
| now:'d MMM yyyy'}} => '1 Jan 2001'
Fill the beginning of a string with a character.
RING | prefill[:LENGTH][:CH]}}
Options:
0
).' | prefill}} => '01'
' | prefill:2:'a'}} => 'a1'
' | prefill:3}} => '001'