'use strict';

/* Filters */

angular.module('lexicon.filters', [])
	.filter('orderAsArray', function() {
		return function(obj, keyName) {
			var result = [];
			angular.forEach(obj, function(val, key) {
				// if keyName defined, include key in val object
				if (keyName) {
					val[keyName] = key;
				}
				result.push(val);
			});
			return result;
		};
	})
	;

'use strict';

/* Filters */

angular.module('lexicon.filters', [])
	.filter('orderAsArray', function() {
		return function(obj, keyName) {
			var result = [];
			angular.forEach(obj, function(val, key) {
				var newVal = angular.copy(val);
				// if keyName defined, include key in val object
				if (keyName) {
					newVal[keyName] = key;
				}
				result.push(newVal);
			});
			return result;
		};
	})
	;

fix filter so it doesn't modify original