From d4bcee07998d0f6a613821c52001b9f6b37b42f3 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 17 Nov 2010 12:54:14 -0800 Subject: toJson and fromJson jsdocs --- src/JSON.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/JSON.js b/src/JSON.js index 9fca3bcb..abb895e0 100644 --- a/src/JSON.js +++ b/src/JSON.js @@ -1,11 +1,34 @@ var array = [].constructor; +/** + * @ngdoc function + * @name angular.toJson + * @function + * + * @description + * Serializes the input into a JSON formated string. + * + * @param {Object|Array|Date|string|number} obj Input to jsonify. + * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace. + * @returns {string} Jsonified string representing `obj`. + */ function toJson(obj, pretty) { var buf = []; toJsonArray(buf, obj, pretty ? "\n " : _null, []); return buf.join(''); } +/** + * @ngdoc function + * @name angular.fromJson + * @function + * + * @description + * Deserializes a string in the JSON format. + * + * @param {string} json JSON string to deserialize. + * @returns {Object|Array|Date|string|number} Deserialized thingy. + */ function fromJson(json) { if (!json) return json; try { -- cgit v1.2.3