contentful
Advanced tools
Comparing version 0.1.1 to 0.1.2
22
index.js
'use strict'; | ||
var _ = require('lodash'); | ||
var questor = require('questor'); | ||
@@ -216,9 +217,17 @@ var redefine = require('redefine'); | ||
exports.createClient = _.fnull(function(options) { | ||
return new Client(options); | ||
}, {}); | ||
exports.createClient = function(options) { | ||
return new Client(options || {}); | ||
}; | ||
function exists(value) { | ||
return value != null; | ||
} | ||
function truthy(value) { | ||
return (value !== false) && exists(value); | ||
} | ||
function compacto(object) { | ||
return _.reduce(object, function(compacted, value, key) { | ||
if (_.truthy(value)) compacted[key] = value; | ||
if (truthy(value)) compacted[key] = value; | ||
return compacted; | ||
@@ -229,3 +238,3 @@ }, {}); | ||
function enforcep(object, property) { | ||
if (!_.exists(object[property])) | ||
if (!exists(object[property])) | ||
throw new TypeError('Expected property ' + property); | ||
@@ -242,3 +251,4 @@ } | ||
function isParseableResource(object) { | ||
return _.getPath(object, ['sys', 'type']) in parseableResourceTypes; | ||
return _.isObject(object) && _.isObject(object.sys) && 'type' in object.sys && | ||
object.sys.type in parseableResourceTypes; | ||
} | ||
@@ -245,0 +255,0 @@ |
{ | ||
"name": "contentful", | ||
"description": "Client for Contentful's Content Delivery API", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://www.contentful.com/developers/documentation/content-delivery-api/", | ||
@@ -15,2 +15,3 @@ "main": "index.js", | ||
"contentful-resolve-response": "~0.1.0", | ||
"lodash": "~2.4.1", | ||
"questor": "1.0.0-alpha.2", | ||
@@ -21,3 +22,3 @@ "redefine": "~0.2.0" | ||
"buster": "~0.7.6", | ||
"bluebird": "~1.0.0", | ||
"bluebird": "~1.2.4", | ||
"envify": "~1.0.1", | ||
@@ -30,4 +31,5 @@ "testem": "~0.6.2", | ||
"prepare-browser-test": "browserify -d -t envify -x buster test/helper.js > test/bundle-helper.js", | ||
"test": "testem ci -P 6" | ||
"test": "testem ci -P 6", | ||
"test-local": "testem" | ||
} | ||
} |
'use strict'; | ||
global._ = require('underscore-contrib'); | ||
global._ = require('lodash'); | ||
@@ -5,0 +5,0 @@ if (typeof buster === 'undefined') { |
@@ -16,3 +16,4 @@ 'use strict'; | ||
return client.contentTypes({ | ||
'order': 'name' | ||
'order': 'name', | ||
'sys.id[in]': 'cat,dog,human' | ||
}).then(function(contentTypes) { | ||
@@ -19,0 +20,0 @@ assert.match(contentTypes, [ |
Sorry, the diff of this file is not supported yet
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
391518
29
4760
4
+ Addedlodash@~2.4.1
+ Addedlodash@2.4.2(transitive)