contentful-resolve-response
Advanced tools
Comparing version 0.1.0 to 0.1.1
26
index.js
'use strict'; | ||
var _ = require('lodash-contrib'); | ||
module.exports = resolveResponse; | ||
@@ -15,3 +13,3 @@ | ||
function isLink(object) { | ||
return _.getPath(object, ['sys', 'type']) === 'Link'; | ||
return object && object.sys && object.sys.type === 'Link'; | ||
} | ||
@@ -25,4 +23,4 @@ | ||
}; | ||
return _.find(response.items, pred) || | ||
response.includes && _.find(response.includes[type], pred); | ||
return find(response.items, pred) || | ||
response.includes && find(response.includes[type], pred); | ||
} | ||
@@ -34,6 +32,8 @@ | ||
if (_.isArray(input) || _.isObject(input)) { | ||
_.each(input, function(item, key) { | ||
input[key] = walkMutate(item, pred, mutator); | ||
}); | ||
if (input && typeof input == 'object') { | ||
for (var key in input) { | ||
if (input.hasOwnProperty(key)) { | ||
input[key] = walkMutate(input[key], pred, mutator); | ||
} | ||
} | ||
return input; | ||
@@ -44,1 +44,9 @@ } | ||
} | ||
function find (array, pred) { | ||
for (var i = 0, len = array.length; i < len; i++) { | ||
if (pred(array[i])) { | ||
return array[i]; | ||
} | ||
} | ||
} |
{ | ||
"name": "contentful-resolve-response", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "", | ||
@@ -21,6 +21,3 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://github.com:contentful/contentful-resolve-response", | ||
"dependencies": { | ||
"lodash-contrib": "^241.4.7" | ||
} | ||
"homepage": "https://github.com:contentful/contentful-resolve-response" | ||
} |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
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
4103
0
89
1
1
- Removedlodash-contrib@^241.4.7
- Removedlodash@2.4.1(transitive)
- Removedlodash-contrib@241.4.14(transitive)