Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Minor changes #207

Merged
merged 2 commits into from
Feb 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions lib/abaaso.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license BSD-3 <https://raw.github.com/avoidwork/abaaso/master/LICENSE>
* @link http://abaaso.com
* @module abaaso
* @version 3.4.19
* @version 3.4.20
*/

(function (global) {
Expand Down Expand Up @@ -2557,14 +2557,12 @@ var data = {
deferred2, record, obj, method, events, args, uri, p, success, failure;

deferred2 = deferred.then(function (arg) {
var data = utility.clone(arg),
var data = {data: null, key: arg.key, record: arg.record},
deferred = promise.factory(),
record, uri;

// Decorating Functions that were lost with JSON encode/decode of `utility.clone()`
utility.iterate(arg.data, function (v, k) {
if (typeof v === "function") data.data[k] = v;
});
// Making sure nothing is by reference
data.data = utility.clone(arg.data);

deferred.then(function (arg) {
if (self.retrieve) self.crawl(arg);
Expand Down Expand Up @@ -5852,7 +5850,14 @@ var utility = {
else if (obj instanceof Object) {
// If JSON encoding fails due to recursion, the original Object is returned because it's assumed this is for decoration
clone = json.encode(obj, true);
clone = clone !== undefined ? json.decode(clone) : obj;
if (clone !== undefined) {
clone = json.decode(clone);
// Decorating Functions that would be lost with JSON encoding/decoding
utility.iterate(obj, function (v, k) {
if (typeof v === "function") clone[k] = v;
});
}
else clone = obj;
return clone;
}
else return obj;
Expand Down Expand Up @@ -6885,7 +6890,7 @@ var xhr = function () {
XMLHttpRequest, headers, handler, handlerError, state;

headers = {
"User-Agent" : "abaaso/3.4.19 node.js/" + process.versions.node.replace(/^v/, "") + " (" + string.capitalize(process.platform) + " V8/" + process.versions.v8 + ")",
"User-Agent" : "abaaso/3.4.20 node.js/" + process.versions.node.replace(/^v/, "") + " (" + string.capitalize(process.platform) + " V8/" + process.versions.v8 + ")",
"Content-Type" : "text/plain",
"Accept" : "*/*"
};
Expand Down Expand Up @@ -7815,7 +7820,7 @@ return {
},
update : element.update,
validate : validate.test,
version : "3.4.19",
version : "3.4.20",
walk : utility.walk
};

Expand Down
4 changes: 2 additions & 2 deletions lib/abaaso.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "abaaso",
"description": "abaaso is a modern, lightweight Enterprise class RESTful JavaScript application framework.",
"version": "3.4.19",
"version": "3.4.20",
"homepage": "http://abaaso.com",
"author": {
"name": "Jason Mulligan",
Expand Down
8 changes: 3 additions & 5 deletions src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,14 +863,12 @@ var data = {
deferred2, record, obj, method, events, args, uri, p, success, failure;

deferred2 = deferred.then(function (arg) {
var data = utility.clone(arg),
var data = {data: null, key: arg.key, record: arg.record},
deferred = promise.factory(),
record, uri;

// Decorating Functions that were lost with JSON encode/decode of `utility.clone()`
utility.iterate(arg.data, function (v, k) {
if (typeof v === "function") data.data[k] = v;
});
// Making sure nothing is by reference
data.data = utility.clone(arg.data);

deferred.then(function (arg) {
if (self.retrieve) self.crawl(arg);
Expand Down
9 changes: 8 additions & 1 deletion src/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ var utility = {
else if (obj instanceof Object) {
// If JSON encoding fails due to recursion, the original Object is returned because it's assumed this is for decoration
clone = json.encode(obj, true);
clone = clone !== undefined ? json.decode(clone) : obj;
if (clone !== undefined) {
clone = json.decode(clone);
// Decorating Functions that would be lost with JSON encoding/decoding
utility.iterate(obj, function (v, k) {
if (typeof v === "function") clone[k] = v;
});
}
else clone = obj;
return clone;
}
else return obj;
Expand Down