Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Commit be30da2

Browse files
[FIX] add names to anonymous functions
for debugging purposes
1 parent c1fc2b2 commit be30da2

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

src/js/filters/filters.filter.js

+50-50
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ var currencies = require('../data/currencies');
1010
*
1111
* If the parameter is a number, the number is treated the relative
1212
*/
13-
module.filter('rpamount', function() {
14-
return function (input, options) {
13+
module.filter('rpamount', function rpamountFilter() {
14+
return function rpamount(input, options) {
1515
var currency;
1616
var opts = jQuery.extend(true, {}, options);
1717

@@ -152,8 +152,8 @@ module.filter('rpamount', function() {
152152
* If the input is neither an Amount or Currency object it will be passed to
153153
* Amount#from_json to try to interpret it.
154154
*/
155-
module.filter('rpcurrency', function() {
156-
return function (input) {
155+
module.filter('rpcurrency', function rpcurrencyFilter() {
156+
return function rpcurrency(input) {
157157
if (!input) return "";
158158

159159
var currency;
@@ -171,8 +171,8 @@ module.filter('rpcurrency', function() {
171171
/**
172172
* Get the currency issuer.
173173
*/
174-
module.filter('rpissuer', function() {
175-
return function (input) {
174+
module.filter('rpissuer', function rpissuerFilter() {
175+
return function rpissuer(input) {
176176
if (!input) return "";
177177

178178
var amount = Amount.from_json(input);
@@ -185,8 +185,8 @@ module.filter('rpissuer', function() {
185185
/**
186186
* Get the full currency name from an Amount.
187187
*/
188-
module.filter('rpcurrencyfull', ['$rootScope', function ($scope) {
189-
return function (input) {
188+
module.filter('rpcurrencyfull', ['$rootScope', function rpcurrencyfullFilter($scope) {
189+
return function rpcurrencyfull(input) {
190190
if (!input) return "";
191191

192192
var amount = Amount.from_json(input);
@@ -203,8 +203,8 @@ module.filter('rpcurrencyfull', ['$rootScope', function ($scope) {
203203
/**
204204
* Calculate a ratio of two Amounts.
205205
*/
206-
module.filter('rpamountratio', function() {
207-
return function (numerator, denominator) {
206+
module.filter('rpamountratio', function rpamountratioFilter() {
207+
return function rpamountratio(numerator, denominator) {
208208
try {
209209
return Amount.from_json(numerator).ratio_human(denominator, {reference_date: new Date()});
210210
} catch (err) {
@@ -216,8 +216,8 @@ module.filter('rpamountratio', function() {
216216
/**
217217
* Calculate the sum of two Amounts.
218218
*/
219-
module.filter('rpamountadd', function() {
220-
return function (a, b) {
219+
module.filter('rpamountadd', function rpamountaddFilter() {
220+
return function rpamountadd(a, b) {
221221
try {
222222
b = Amount.from_json(b);
223223
if (b.is_zero()) return a;
@@ -230,8 +230,8 @@ module.filter('rpamountadd', function() {
230230
/**
231231
* Calculate the difference of two Amounts.
232232
*/
233-
module.filter('rpamountsubtract', function() {
234-
return function (a, b) {
233+
module.filter('rpamountsubtract', function rpamountsubtractFilter() {
234+
return function rpamountsubtract(a, b) {
235235
try {
236236
return Amount.from_json(a).subtract(b);
237237
} catch (err) {
@@ -247,8 +247,8 @@ module.filter('rpamountsubtract', function() {
247247
*/
248248
var momentCache = {};
249249

250-
module.filter('rpfromnow', function() {
251-
return function (input) {
250+
module.filter('rpfromnow', function rpfromnowFilter() {
251+
return function rpfromnow(input) {
252252
// This is an expensive function, cache it
253253
if (!momentCache[input]) momentCache[input] = moment(input).fromNow();
254254

@@ -261,8 +261,8 @@ module.filter('rpfromnow', function() {
261261
*
262262
* Shows a ripple name for a given ripple address
263263
*/
264-
module.filter("rpripplename", ['rpId', function(id) {
265-
return function(address, options) {
264+
module.filter("rpripplename", ['rpId', function rpripplenameFilter(id) {
265+
return function rpripplename(address, options) {
266266
var ripplename = id.resolveNameSync(address, options);
267267
if (ripplename !== address) {
268268
return ripplename;
@@ -274,8 +274,8 @@ module.filter("rpripplename", ['rpId', function(id) {
274274
}
275275
}]);
276276

277-
module.filter("rpripplenamefull", ['rpId', function(id) {
278-
return function(address, options) {
277+
module.filter("rpripplenamefull", ['rpId', function rpripplenamefullFilter(id) {
278+
return function rpripplenamefull(address, options) {
279279
var ripplename = id.resolveNameSync(address, options);
280280
if (ripplename !== address) {
281281
return ripplename;
@@ -287,8 +287,8 @@ module.filter("rpripplenamefull", ['rpId', function(id) {
287287
/**
288288
* Show contact name or address
289289
*/
290-
module.filter('rpcontactname', ['$rootScope', function ($scope) {
291-
return function (address) {
290+
module.filter('rpcontactname', ['$rootScope', function rpcontactnameFilter($scope) {
291+
return function rpcontactname(address) {
292292
address = address ? ""+address : "";
293293

294294
var contact = webutil.getContact($scope.userBlob.data.contacts, address);
@@ -301,8 +301,8 @@ module.filter('rpcontactname', ['$rootScope', function ($scope) {
301301
};
302302
}]);
303303

304-
module.filter('rpcontactnamefull', ['$rootScope', function ($scope) {
305-
return function (address) {
304+
module.filter('rpcontactnamefull', ['$rootScope', function rpcontactnamefullFilter($scope) {
305+
return function rpcontactnamefull(address) {
306306
address = address ? ""+address : "";
307307
var contact = webutil.getContact($scope.userBlob.data.contacts, address);
308308

@@ -314,8 +314,8 @@ module.filter('rpcontactnamefull', ['$rootScope', function ($scope) {
314314
};
315315
}]);
316316

317-
module.filter('rponlycontactname', ['$rootScope', function ($scope) {
318-
return function (address) {
317+
module.filter('rponlycontactname', ['$rootScope', function rponlycontactnameFilter($scope) {
318+
return function rponlycontactname(address) {
319319
address = address ? ""+address : "";
320320

321321
var contact = webutil.getContact($scope.userBlob.data.contacts, address);
@@ -331,8 +331,8 @@ module.filter('rponlycontactname', ['$rootScope', function ($scope) {
331331
*
332332
* The number of the bullets will correspond to the length of the string.
333333
*/
334-
module.filter('rpmask', function() {
335-
return function (pass) {
334+
module.filter('rpmask', function rpmaskFilter() {
335+
return function rpmask(pass) {
336336
pass = ""+pass;
337337
return Array(pass.length+1).join("•");
338338
};
@@ -343,8 +343,8 @@ module.filter('rpmask', function() {
343343
*
344344
* The number of the bullets will correspond to the length of the string.
345345
*/
346-
module.filter('rptruncate', function() {
347-
return function (str, len) {
346+
module.filter('rptruncate', function rptruncateFilter() {
347+
return function rptruncate(str, len) {
348348
return str ? str.slice(0, len) : '';
349349
};
350350
});
@@ -355,7 +355,7 @@ module.filter('rptruncate', function() {
355355
* Based on code by aioobe @ StackOverflow.
356356
* @see http://stackoverflow.com/questions/3758606
357357
*/
358-
module.filter('rpfilesize', function() {
358+
module.filter('rpfilesize', function rpfilesizeFilter() {
359359
function number_format( number, decimals, dec_point, thousands_sep ) {
360360
// http://kevin.vanzonneveld.net
361361
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
@@ -387,7 +387,7 @@ module.filter('rpfilesize', function() {
387387
//var prefixes = "KMGTPE";
388388
//var common = "iB";
389389

390-
return function (str) {
390+
return function rpfilesize(str) {
391391
var bytes = +str;
392392
if (bytes < unit) return bytes + " B";
393393
var exp = Math.floor(Math.log(bytes) / Math.log(unit));
@@ -399,8 +399,8 @@ module.filter('rpfilesize', function() {
399399
/**
400400
* Uppercase the first letter.
401401
*/
402-
module.filter('rpucfirst', function() {
403-
return function (str) {
402+
module.filter('rpucfirst', function rpucfirstFilter() {
403+
return function rpucfirst(str) {
404404
str = ""+str;
405405
return str.charAt(0).toUpperCase() + str.slice(1);
406406
};
@@ -413,8 +413,8 @@ module.filter('rpucfirst', function() {
413413
* Example1 : ng-repeat="n in [20] | rprange"
414414
* Example2 : ng-repeat="n in [10, 35] | rprange"
415415
*/
416-
module.filter('rprange', function() {
417-
return function(input) {
416+
module.filter('rprange', function rprangeFilter() {
417+
return function rprange(input) {
418418
var lowBound, highBound;
419419
switch (input.length) {
420420
case 1:
@@ -435,15 +435,15 @@ module.filter('rprange', function() {
435435
};
436436
});
437437

438-
module.filter('rpaddressorigin', function() {
439-
return function(recipient) {
438+
module.filter('rpaddressorigin', function rpaddressoriginFilter() {
439+
return function rpaddressorigin(recipient) {
440440
if (~recipient.indexOf('@')) return 'federation';
441441
return !isNaN(Base.decode_check([0, 5], recipient, 'bitcoin')) ? 'bitcoin' : 'ripple';
442442
};
443443
});
444444

445-
module.filter('rpheavynormalize', function() {
446-
return function (value, maxLength) {
445+
module.filter('rpheavynormalize', function rpheavynormalizeFilter() {
446+
return function rpheavynormalize(value, maxLength) {
447447
return String(value)
448448
// Remove non-printable and non-ASCII characters
449449
.replace(/[^ -~]/g, '')
@@ -461,8 +461,8 @@ module.filter('rpheavynormalize', function() {
461461
/**
462462
* Used to filter My Orders on trade tab.
463463
*/
464-
module.filter('rpcurrentpair', function() {
465-
return function (items, doFilter, currentKey) {
464+
module.filter('rpcurrentpair', function rpcurrentpairFilter() {
465+
return function rpcurrentpair(items, doFilter, currentKey) {
466466
if (!doFilter) {
467467
return items;
468468
}
@@ -489,8 +489,8 @@ module.filter('rpcurrentpair', function() {
489489
* Return object properties.
490490
* Used in trade tab to make My Orders list sortable.
491491
*/
492-
module.filter('rpvalues', function() {
493-
return function (items_object) {
492+
module.filter('rpvalues', function rpvaluesFilter() {
493+
return function rpvalues(items_object) {
494494
var values = _.values(items_object);
495495
return _.values(items_object);
496496
}
@@ -499,8 +499,8 @@ module.filter('rpvalues', function() {
499499
/**
500500
* My Orders widget sorting filter.
501501
*/
502-
module.filter('rpsortmyorders', function() {
503-
return function (items_object, field, reverse) {
502+
module.filter('rpsortmyorders', function rpsortmyordersFilter() {
503+
return function rpsortmyorders(items_object, field, reverse) {
504504
var arrayCopy = items_object.slice(0);
505505
arrayCopy.sort(function(a, b) {
506506
var res = 0;
@@ -542,8 +542,8 @@ module.filter('rpsortmyorders', function() {
542542
/**
543543
* Contacts sorting filter
544544
*/
545-
module.filter('rpsortcontacts', function() {
546-
return function (items_object, field, reverse) {
545+
module.filter('rpsortcontacts', function rpsortcontactsFilter() {
546+
return function rpsortcontacts(items_object, field, reverse) {
547547
var arrayCopy = items_object.slice(0);
548548
arrayCopy.sort(function(a, b) {
549549
var res = 0;
@@ -565,8 +565,8 @@ module.filter('rpsortcontacts', function() {
565565
}
566566
});
567567

568-
module.filter('rprange', function() {
569-
return function(input, total) {
568+
module.filter('rprange', function rprangeFilter() {
569+
return function rprange(input, total) {
570570
total = parseInt(total, 10);
571571
for (var i = 1; i <= total; i++)
572572
input.push(i);

0 commit comments

Comments
 (0)