Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "ss-utils", | ||
"title": "ServiceStack JavaScript Utils", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "ServiceStack's JavaScript library providing a number of convenience utilities in developing javascript web apps. Integrates with ServiceStack's Server features including Error Handling, Validation and Server Events", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/ServiceStack/ss-utils", |
@@ -28,2 +28,3 @@ // Type definitions for ServiceStack Utils v0.0.1 | ||
humanize: (s: string) => string; | ||
normalize: (dto:any, into?:any, deep?:boolean) => any; | ||
parseResponseStatus: (json: string, defaultMsg?: string) => any; | ||
@@ -30,0 +31,0 @@ postJSON: (url: string, data: Object | String, success?: Function, error?: Function) => any; |
@@ -122,2 +122,10 @@ ;(function (root, f) { | ||
} | ||
$.ss.normalize = function (dto, into, deep) { | ||
if (typeof dto != "object") return dto; | ||
if (!into) into = {}; | ||
for (var k in dto) { | ||
into[k.toLowerCase().replace(/_/g, '')] = deep ? normalize(dto[k]) : dto[k]; | ||
} | ||
return into; | ||
}; | ||
function sanitize(status) { | ||
@@ -138,3 +146,2 @@ if (status["errors"]) | ||
} | ||
$.ss.parseResponseStatus = function (json, defaultMsg) { | ||
@@ -141,0 +148,0 @@ try { |
29202
682