diff options
| author | Igor Minar | 2010-11-17 12:54:14 -0800 |
|---|---|---|
| committer | Igor Minar | 2010-11-18 02:34:54 -0800 |
| commit | d4bcee07998d0f6a613821c52001b9f6b37b42f3 (patch) | |
| tree | f94ccba8451e5bf9387c8c43bd4fb0b4c251ebfd /src/JSON.js | |
| parent | dd687e2bf565c48d00e47f9af666cee4a2b9abd9 (diff) | |
| download | angular.js-d4bcee07998d0f6a613821c52001b9f6b37b42f3.tar.bz2 | |
toJson and fromJson jsdocs
Diffstat (limited to 'src/JSON.js')
| -rw-r--r-- | src/JSON.js | 23 |
1 files changed, 23 insertions, 0 deletions
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 { |
