Comparing version 1.3.5 to 1.3.6
@@ -7,2 +7,5 @@ # Change Log | ||
## [1.3.6] - 2016-07-14 | ||
- [#148](https://github.com/SparkPost/node-sparkpost/pull/148) Preserve array/object structure of API data (@gpittarelli) | ||
## [1.3.5] - 2016-05-13 | ||
@@ -9,0 +12,0 @@ - [#146](https://github.com/SparkPost/node-sparkpost/pull/146) Single recipient suppression list upserts now use the bulk update endpoint (@jgzamora) |
@@ -15,3 +15,2 @@ 'use strict'; | ||
function snakedKeyClone(source) { | ||
if (!_.isObject(source)) { | ||
@@ -21,12 +20,4 @@ return source; | ||
var target = {}; | ||
var target = Array.isArray(source) ? [] : {}; | ||
if (Array.isArray(source)) { | ||
target = []; | ||
for (var i = 0; i < source.length; i++) { | ||
target.push(snakedKeyClone(source[i])); | ||
} | ||
return target; | ||
} | ||
Object.keys(source).forEach(function(key) { | ||
@@ -56,4 +47,6 @@ target[_.snakeCase(key)] = snakedKeyClone(source[key]); | ||
// Reinstated the un-modified objects into the target | ||
pointer.walk(excludedObjects, function(val, ptr) { | ||
pointer.set(target, ptr, val); | ||
excludeList.forEach(function(exclusionPointer) { | ||
if (pointer.has(excludedObjects, exclusionPointer)) { | ||
pointer.set(target, exclusionPointer, pointer.get(excludedObjects, exclusionPointer)); | ||
} | ||
}); | ||
@@ -60,0 +53,0 @@ |
{ | ||
"name": "sparkpost", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "A Node.js wrapper for interfacing with your favorite SparkPost APIs", | ||
@@ -5,0 +5,0 @@ "main": "./lib/sparkpost.js", |
@@ -158,2 +158,28 @@ 'use strict'; | ||
}); | ||
it('should preserve objects with number properties', function(done) { | ||
var testObj = { | ||
array: [ 0, 1, , , , 5, 6] | ||
, object: { | ||
"0": 0, | ||
"1": 1, | ||
"5": 5, | ||
"6": 6 | ||
} | ||
, substitution_data: { | ||
"0": 0, | ||
"1": 1, | ||
"5": 5, | ||
"6": 6 | ||
} | ||
, tags: [ 0, 1, , , , 5, 6] | ||
}; | ||
var out = toApiFormat(_.clone(testObj)); | ||
expect(out).to.deep.equal(testObj); | ||
done(); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
281961
130
4704
0