mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 17:41:43 -05:00
- 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:
parent
85c57c4beb
commit
9be92d0903
2 changed files with 11 additions and 6 deletions
|
@ -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 } });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -329,9 +329,9 @@ Utils.findIndex = (array, predicate) => {
|
|||
// adapted from http://stackoverflow.com/a/22072374/649299
|
||||
Utils.unflatten = function(array, options, parent, level=0, tree){
|
||||
|
||||
const {
|
||||
idProperty = '_id',
|
||||
parentIdProperty = 'parentId',
|
||||
const {
|
||||
idProperty = '_id',
|
||||
parentIdProperty = 'parentId',
|
||||
childrenProperty = 'childrenResults'
|
||||
} = options;
|
||||
|
||||
|
@ -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) => {
|
||||
|
@ -507,4 +512,4 @@ Utils.removeProperty = (obj, propertyName) => {
|
|||
Utils.removeProperty(obj[prop], propertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue