contentful
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "contentful", | ||
"version": "0.0.10", | ||
"main": "dist/contentful.min.js", | ||
@@ -5,0 +4,0 @@ "ignore": [ |
25
index.js
'use strict'; | ||
var _ = require('underscore-contrib'); | ||
var questor = require('questor'); | ||
var redefine = require('redefine'); | ||
var resolveResponse = require('contentful-resolve-response'); | ||
var querystring = require('querystring'); | ||
@@ -146,3 +146,3 @@ | ||
walkMutate(object, isParseableResource, parseResource); | ||
var items = resolveLinks(object); | ||
var items = resolveResponse(object); | ||
return redefine( | ||
@@ -260,23 +260,2 @@ items, { | ||
function resolveLinks(response) { | ||
walkMutate(response, isLink, function(link) { | ||
return getLink(response, link) || link; | ||
}); | ||
return response.items; | ||
} | ||
function isLink(object) { | ||
return _.getPath(object, ['sys', 'type']) === 'Link'; | ||
} | ||
function getLink(response, link) { | ||
var type = link.sys.linkType; | ||
var id = link.sys.id; | ||
var pred = function(resource) { | ||
return resource.sys.type === type && resource.sys.id === id; | ||
}; | ||
return _.find(response.items, pred) || | ||
response.includes && _.find(response.includes[type], pred); | ||
} | ||
function walkMutate(input, pred, mutator) { | ||
@@ -283,0 +262,0 @@ if (pred(input)) |
{ | ||
"name": "contentful", | ||
"description": "Client for Contentful's Content Delivery API", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://www.contentful.com/developers/documentation/content-delivery-api/", | ||
@@ -14,5 +14,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"redefine": "~0.2.0", | ||
"contentful-resolve-response": "~0.1.0", | ||
"questor": "1.0.0-alpha.2", | ||
"underscore-contrib": "~0.2.1" | ||
"redefine": "~0.2.0" | ||
}, | ||
@@ -28,5 +28,5 @@ "devDependencies": { | ||
"scripts": { | ||
"test": "testem ci", | ||
"prepare-browser-test": "browserify -d -t envify -x buster test/helper.js > test/bundle-helper.js" | ||
"prepare-browser-test": "browserify -d -t envify -x buster test/helper.js > test/bundle-helper.js", | ||
"test": "testem ci -P 6" | ||
} | ||
} |
@@ -11,2 +11,9 @@ # contentful.js | ||
Supported browsers/environments: | ||
- Chrome | ||
- Firefox | ||
- IE10 | ||
- node.js >= 0.8 | ||
## Install | ||
@@ -71,4 +78,17 @@ | ||
## Functionality | ||
### supported | ||
* .space() = get details of current space | ||
* .contentTypes() = get content types of current space | ||
* .entries() = get entries of current space | ||
* ... | ||
### not supported | ||
* Sync | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
93
7
391177
4751
+ Addedcontentful-resolve-response@0.1.2(transitive)
- Removedunderscore-contrib@~0.2.1