Commit a2d9b07b authored by Robert Knight's avatar Robert Knight

Replace Angular utility methods with JS standard lib functions

Unless there is a clear reason not to do so, it is generally preferred
to use methods from the ECMA standard lib.
parent dea5bf72
'use strict'; 'use strict';
var angular = require('angular');
var get = require('lodash.get'); var get = require('lodash.get');
var retryUtil = require('./retry-util'); var retryUtil = require('./retry-util');
...@@ -33,8 +32,8 @@ function forEachSorted(obj, iterator, context) { ...@@ -33,8 +32,8 @@ function forEachSorted(obj, iterator, context) {
function serializeValue(v) { function serializeValue(v) {
if (angular.isObject(v)) { if (typeof v === 'object') {
return angular.isDate(v) ? v.toISOString() : angular.toJson(v); return v instanceof Date ? v.toISOString() : JSON.stringify(v);
} }
return v; return v;
} }
...@@ -63,8 +62,8 @@ function serializeParams(params) { ...@@ -63,8 +62,8 @@ function serializeParams(params) {
if (value === null || typeof value === 'undefined') { if (value === null || typeof value === 'undefined') {
return; return;
} }
if (angular.isArray(value)) { if (Array.isArray(value)) {
angular.forEach(value, function(v, k) { value.forEach(function(v) {
parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
}); });
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment