├── .gitignore ├── .travis.yml ├── README.md ├── bower.json ├── filters.js ├── index.js ├── karma.conf.js ├── karma2.conf.js ├── lib ├── angularjs-mocks │ └── 1.2.20 │ │ └── angular-mocks.js ├── angularjs │ └── 1.2.18 │ │ └── angular.js └── jquery │ └── 2.1.1 │ └── jquery.js ├── package.json └── test ├── browser_tests.js ├── module_tests.js └── tests.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | 3 | .idea/* 4 | npm-debug.log -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | branches: 5 | only: 6 | - master 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://travis-ci.org/sumitchawla/angularjs-filters) [](https://david-dm.org/sumitchawla/angularjs-filters) [](https://david-dm.org/sumitchawla/angularjs-filters#info=devDependencies) 2 | 3 | angularjs-filters 4 | ================= 5 | 6 | A library of common AngularJS filters. Each filter is individually tested for various inputs. The module can be used by using the filter.js in your browser includes, or by using npm module ( with browserify). 7 | 8 | ### Installation 9 | bower install angularjs-filters 10 | 11 | ### String Filters 12 |
Filter | 15 |Usage | 16 |Result | 17 |
---|---|---|
format | 20 |'Hello {0}. What are you been doing this {1}?' | string.format : 'Sam' : 'evening' | 21 |Hello Sam. What are you been doing this evening? | 22 |
html2string | 25 |'Hello <br/>. How are you?' | string.html2string | 26 |Hello . How are you? | 27 |
shorten | 30 |'A long story cut into short' | string.shorten : 12 | 31 |A long story... | 32 |
replace String Replace. Pattern can be a string or regex |
35 |
36 | 'Hello Mr How are you doing' | string.replace : 'Mr': 'Sir' 37 | "hello help"| string.replace:"he[a-z]{2}":"Yell" 38 | |
39 |
40 | Hello Sir How are you doing 41 | Yello Yell 42 | |
43 |
camelcase | 46 |'A long story cut into short' | string.camelcase | 47 |A Long Story Cut Into Short | 48 |
lowercase | 51 |'Convert to LOWERCASE' | string.lowercase | 52 |convert to lowercase | 53 |
uppercase | 56 |'uppercase all' | string.uppercase | 57 |UPPERCASE ALL | 58 |
trim, trimstart, trimend String Trim Functions |
61 | ' Hello Mr. ' | string.trim | 62 |Hello Mr. | 63 |
Filter | 70 |Usage | 71 |Result | 72 |
---|---|---|
join | 75 |['Hello','Mr.','How','Are','You?'] | array.join : '-' | 76 |Hello-Mr.-How-Are-You? | 77 |
reverse | 80 |ng-repeat='["Banana", "Orange", "Apple", "Mango"] | array.reverse' | 81 |"Mango","Apple","Orange", "Banana" | 82 |
Filter | 89 |Usage | 90 |Result | 91 |
---|---|---|
max | 94 |[8, 1, 2, 3, 7] | math.max | 95 |8 | 96 |
min | 99 |[8, 1, 2, 3, 7] | math.min | 100 |1 | 101 |
Filter | 108 |Usage | 109 |Result | 110 |
---|---|---|
YesNo Converts boolean value to Yes/No |
113 | A == B | binary.YesNo | 114 |Yes/No? | 115 |
Filter | 122 |Usage | 123 |Result | 124 |
---|---|---|
print Debug prints the bound value |
127 | 'MyValue' | debug.print | 128 |MyValue | 129 |
Filter | 136 |Usage | 137 |Result | 138 |
---|---|---|
utixtimeconvertor Converts unix timestamp to human readable (friedly) time. |
141 | '1596971407' | utixtimeconvertor | 142 |9 Aug 2020 - 4:10:7 | 143 |
Request expectations | Backend definitions | |
---|---|---|
Syntax | 927 | *.expect(...).respond(...) | 928 | *.when(...).respond(...) | 929 | *
Typical usage | 932 | *strict unit tests | 933 | *loose (black-box) unit testing | 934 | *
Fulfills multiple requests | 937 | *NO | 938 | *YES | 939 | *
Order of requests matters | 942 | *YES | 943 | *NO | 944 | *
Request required | 947 | *YES | 948 | *NO | 949 | *
Response required | 952 | *optional (see below) | 953 | *YES | 954 | *