contentful
Advanced tools
Comparing version 1.1.3 to 1.1.4
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## v1.1.4 - 2015-08-24 | ||
- Removed lodash dependency | ||
## 1.1.3 | ||
@@ -5,0 +8,0 @@ ### Fixed |
@@ -284,3 +284,9 @@ "use strict"; | ||
function Space() { | ||
var props = arguments[0] === undefined ? {} : arguments[0]; | ||
_classCallCheck(this, Space); | ||
for (var k in props) { | ||
this[k] = props[k]; | ||
} | ||
} | ||
@@ -291,3 +297,3 @@ | ||
value: function parse(object) { | ||
return _.extend(new Space(), object); | ||
return new Space(object); | ||
} | ||
@@ -367,2 +373,4 @@ } | ||
value: function append(data) { | ||
var _this = this; | ||
this.items = this.items.concat(data.items); | ||
@@ -372,3 +380,8 @@ | ||
var nextPageUrl = data.nextPageUrl.split("?"); | ||
this.query = _.omit(this.query, "initial", "type", "sync_token"); | ||
this.query = Object.keys(this.query).reduce(function (query, key) { | ||
if (key !== "initial" && key !== "type" && key !== "sync_token") { | ||
query[key] = _this.query[key]; | ||
} | ||
return query; | ||
}, {}); | ||
this.query.sync_token = querystring.parse(nextPageUrl[1]).sync_token; | ||
@@ -395,3 +408,3 @@ } else if (data.nextSyncUrl) { | ||
function isParseableResource(object) { | ||
return _.isObject(object) && _.isObject(object.sys) && "type" in object.sys && object.sys.type in parseableResourceTypes; | ||
return object && object.sys && object.sys.type in parseableResourceTypes; | ||
} | ||
@@ -418,3 +431,3 @@ | ||
var value = object[key]; | ||
result[key] = _.isArray(value) ? value.join(",") : value; | ||
result[key] = Array.isArray(value) ? value.join(",") : value; | ||
return result; | ||
@@ -421,0 +434,0 @@ }, {}); |
@@ -192,4 +192,10 @@ 'use strict'; | ||
static parse (object) { | ||
return _.extend(new Space(), object); | ||
return new Space(object); | ||
} | ||
constructor (props = {}) { | ||
for (let k in props) { | ||
this[k] = props[k] | ||
} | ||
} | ||
} | ||
@@ -236,3 +242,8 @@ | ||
const nextPageUrl = data.nextPageUrl.split('?'); | ||
this.query = _.omit(this.query, 'initial', 'type', 'sync_token'); | ||
this.query = Object.keys(this.query).reduce((query, key) => { | ||
if (key !== 'initial' && key !== 'type' && key !== 'sync_token') { | ||
query[key] = this.query[key] | ||
} | ||
return query | ||
}, {}) | ||
this.query.sync_token = querystring.parse(nextPageUrl[1]).sync_token; | ||
@@ -255,4 +266,3 @@ } else if (data.nextSyncUrl) { | ||
function isParseableResource (object) { | ||
return _.isObject(object) && _.isObject(object.sys) && 'type' in object.sys && | ||
object.sys.type in parseableResourceTypes; | ||
return object && object.sys && object.sys.type in parseableResourceTypes; | ||
} | ||
@@ -279,3 +289,3 @@ | ||
const value = object[key]; | ||
result[key] = _.isArray(value) ? value.join(',') : value; | ||
result[key] = Array.isArray(value) ? value.join(',') : value; | ||
return result; | ||
@@ -282,0 +292,0 @@ }, {}); |
{ | ||
"name": "contentful", | ||
"description": "Client for Contentful's Content Delivery API", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"homepage": "https://www.contentful.com/developers/documentation/content-delivery-api/", | ||
@@ -24,3 +24,2 @@ "main": "index.js", | ||
"jscs": "^1.12.0", | ||
"lodash": "~2.4.1", | ||
"saucie": "^0.1.0", | ||
@@ -27,0 +26,0 @@ "testem": "~0.6.2", |
'use strict'; | ||
global._ = require('lodash'); | ||
if (typeof buster === 'undefined') { | ||
@@ -6,0 +4,0 @@ global.buster = require('buster'); |
@@ -16,7 +16,9 @@ 'use strict'; | ||
return client.assets().then(function(assets) { | ||
assert(_.any(assets, function(asset) { | ||
var asset = assets.filter(function (asset) { | ||
return asset.fields.title === 'Nyan Cat'; | ||
})); | ||
})[0]; | ||
assert(asset); | ||
}); | ||
} | ||
}); |
@@ -16,7 +16,9 @@ 'use strict'; | ||
return client.entries().then(function(entries) { | ||
assert(_.any(entries, function(entry) { | ||
var entry = entries.filter(function (entry) { | ||
return entry.fields.name === 'Nyan Cat'; | ||
})); | ||
})[0]; | ||
assert(entry); | ||
}); | ||
} | ||
}); |
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
730396
11
13633