- Fixed bug in single resolver (slug is undefined)

- Fixed bug in Utils.pluralize (pluralizing words ending in 's', for example address => addresses)
This commit is contained in:
Erik Dakoda 2018-09-13 10:46:10 -04:00
parent 85c57c4beb
commit 9be92d0903
2 changed files with 11 additions and 6 deletions

View file

@ -120,7 +120,7 @@ export function getDefaultResolvers(options) {
return { result: null };
} else {
const MissingDocumentError = createError('app.missing_document', { message: 'app.missing_document' });
throw new MissingDocumentError({ data: { documentId, slug } });
throw new MissingDocumentError({ data: { documentId, selector } });
}
}

View file

@ -496,7 +496,12 @@ String.prototype.replaceAll = function(search, replacement) {
Utils.isPromise = value => isFunction(get(value, 'then'));
Utils.pluralize = s => {
return s.slice(-1) === 'y' ? `${s.slice(0,-1)}ies` : `${s}s`;
const plural = s.slice(-1) === 'y' ?
`${s.slice(0, -1)}ies` :
s.slice(-1) === 's' ?
`${s}es` :
`${s}s`;
return plural;
}
Utils.removeProperty = (obj, propertyName) => {