@medmain/core
Advanced tools
Comparing version 0.1.32 to 0.1.33
@@ -130,3 +130,3 @@ export var ItemSelection = | ||
mode: this.mode, | ||
itemIds: this.itemIds | ||
itemIds: Array.from(this.itemIds) | ||
}; | ||
@@ -133,0 +133,0 @@ }; |
@@ -29,3 +29,3 @@ import capitalize from 'lodash/capitalize'; | ||
lastName = _ref.lastName; | ||
return this.lastNameIsBeforeFirstName ? `${lastName} ${firstName}` : `${firstName} ${lastName}`; | ||
return this.lastNameIsBeforeFirstName ? lastName + " " + firstName : firstName + " " + lastName; | ||
}, | ||
@@ -75,3 +75,3 @@ // === Error dialog === | ||
if (!text) { | ||
throw new Error(`Invalid month number: ${monthNumber}`); | ||
throw new Error("Invalid month number: " + monthNumber); | ||
} | ||
@@ -104,3 +104,3 @@ | ||
if (!text) { | ||
throw new Error(`Invalid day of the week number: ${day}`); | ||
throw new Error("Invalid day of the week number: " + day); | ||
} | ||
@@ -107,0 +107,0 @@ |
@@ -16,3 +16,3 @@ export function resolveLocale(_ref) { | ||
if (!firstAvailableLocale) { | ||
throw new Error(`Unable to resolve "${localeId}"`); | ||
throw new Error("Unable to resolve \"" + localeId + "\""); | ||
} | ||
@@ -19,0 +19,0 @@ |
@@ -68,7 +68,7 @@ import get from 'lodash/get'; | ||
return query; | ||
}; // Transform the old style object queries to array queries | ||
} // Transform the old style object queries to array queries | ||
// {image: {filename: '123.jpg'}} | ||
// => [{field: 'image.filename', operator: 'is', value: '123.jpg'}] | ||
; | ||
Query.normalizeJSON = function normalizeJSON(json) { | ||
@@ -166,3 +166,3 @@ if (Array.isArray(json)) { | ||
if (!fieldSchema) { | ||
throw new Error(`Field '${field}' not found in the query schema`); | ||
throw new Error("Field '" + field + "' not found in the query schema"); | ||
} | ||
@@ -169,0 +169,0 @@ |
@@ -48,3 +48,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
throw new Error(`'pathsOrProps' argument should be an array or an object`); | ||
throw new Error("'pathsOrProps' argument should be an array or an object"); | ||
} // Transforms an object of props to an array of paths | ||
@@ -62,3 +62,3 @@ // Example: {id: true, image: {filename: true}} => ['id', 'image.filename'] | ||
throw new Error(`'propsOrPaths' argument should be an array or an object`); | ||
throw new Error("'propsOrPaths' argument should be an array or an object"); | ||
} | ||
@@ -69,9 +69,7 @@ | ||
var _arr = Object.entries(props); | ||
for (var _i2 = 0, _Object$entries = Object.entries(props); _i2 < _Object$entries.length; _i2++) { | ||
var _Object$entries$_i = _Object$entries[_i2], | ||
key = _Object$entries$_i[0], | ||
value = _Object$entries$_i[1]; | ||
for (var _i2 = 0; _i2 < _arr.length; _i2++) { | ||
var _arr$_i = _arr[_i2], | ||
key = _arr$_i[0], | ||
value = _arr$_i[1]; | ||
if (_isObject(value)) { | ||
@@ -189,9 +187,7 @@ var subpaths = _getPaths(value); | ||
var _arr2 = Object.entries(props); | ||
for (var _i6 = 0, _Object$entries2 = Object.entries(props); _i6 < _Object$entries2.length; _i6++) { | ||
var _Object$entries2$_i = _Object$entries2[_i6], | ||
key = _Object$entries2$_i[0], | ||
value = _Object$entries2$_i[1]; | ||
for (var _i6 = 0; _i6 < _arr2.length; _i6++) { | ||
var _arr2$_i = _arr2[_i6], | ||
key = _arr2$_i[0], | ||
value = _arr2$_i[1]; | ||
if (_isObject(value)) { | ||
@@ -221,3 +217,3 @@ value = cleanProps(value); | ||
regeneratorRuntime.mark(function _callee(object, customizer) { | ||
var result, _arr3, _i7, _arr3$_i, key, value, newValue; | ||
var result, _i7, _Object$entries3, _Object$entries3$_i, key, value, newValue; | ||
@@ -229,20 +225,19 @@ return regeneratorRuntime.wrap(function _callee$(_context) { | ||
result = {}; | ||
_arr3 = Object.entries(object); | ||
_i7 = 0; | ||
_i7 = 0, _Object$entries3 = Object.entries(object); | ||
case 3: | ||
if (!(_i7 < _arr3.length)) { | ||
_context.next = 19; | ||
case 2: | ||
if (!(_i7 < _Object$entries3.length)) { | ||
_context.next = 18; | ||
break; | ||
} | ||
_arr3$_i = _arr3[_i7], key = _arr3$_i[0], value = _arr3$_i[1]; | ||
_context.next = 7; | ||
_Object$entries3$_i = _Object$entries3[_i7], key = _Object$entries3$_i[0], value = _Object$entries3$_i[1]; | ||
_context.next = 6; | ||
return customizer(value, key); | ||
case 7: | ||
case 6: | ||
newValue = _context.sent; | ||
if (!(newValue !== undefined)) { | ||
_context.next = 11; | ||
_context.next = 10; | ||
break; | ||
@@ -252,28 +247,28 @@ } | ||
result[key] = newValue; | ||
return _context.abrupt("continue", 16); | ||
return _context.abrupt("continue", 15); | ||
case 11: | ||
case 10: | ||
if (!_isObject(value)) { | ||
_context.next = 15; | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 14; | ||
_context.next = 13; | ||
return cloneDeepAsync(value, customizer); | ||
case 14: | ||
case 13: | ||
value = _context.sent; | ||
case 15: | ||
case 14: | ||
result[key] = value; | ||
case 16: | ||
case 15: | ||
_i7++; | ||
_context.next = 3; | ||
_context.next = 2; | ||
break; | ||
case 19: | ||
case 18: | ||
return _context.abrupt("return", result); | ||
case 20: | ||
case 19: | ||
case "end": | ||
@@ -283,3 +278,3 @@ return _context.stop(); | ||
} | ||
}, _callee, this); | ||
}, _callee); | ||
})); | ||
@@ -301,3 +296,3 @@ return _cloneDeepAsync.apply(this, arguments); | ||
regeneratorRuntime.mark(function _callee2(template, resolvers) { | ||
var result, _arr4, _i8, _arr4$_i, name, resolve, regexp, matches, placeholder, args, resolvedExpression; | ||
var result, _i8, _Object$entries4, _Object$entries4$_i, name, resolve, regexp, matches, placeholder, args, resolvedExpression; | ||
@@ -309,12 +304,11 @@ return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
result = template; | ||
_arr4 = Object.entries(resolvers); | ||
_i8 = 0; | ||
_i8 = 0, _Object$entries4 = Object.entries(resolvers); | ||
case 3: | ||
if (!(_i8 < _arr4.length)) { | ||
_context2.next = 17; | ||
case 2: | ||
if (!(_i8 < _Object$entries4.length)) { | ||
_context2.next = 16; | ||
break; | ||
} | ||
_arr4$_i = _arr4[_i8], name = _arr4$_i[0], resolve = _arr4$_i[1]; | ||
_Object$entries4$_i = _Object$entries4[_i8], name = _Object$entries4$_i[0], resolve = _Object$entries4$_i[1]; | ||
// TODO: make it works with multiple occurences of a resolver with different parameters | ||
@@ -325,3 +319,3 @@ regexp = new RegExp('\\$\\{' + name + '(\\(.*?\\))?\\}'); | ||
if (!matches) { | ||
_context2.next = 14; | ||
_context2.next = 13; | ||
break; | ||
@@ -332,18 +326,18 @@ } | ||
args = _parseArguments(args); | ||
_context2.next = 12; | ||
_context2.next = 11; | ||
return resolve.apply(void 0, args); | ||
case 12: | ||
case 11: | ||
resolvedExpression = _context2.sent; | ||
result = result.replace(new RegExp(escapeStringRegexp(placeholder), 'g'), resolvedExpression); | ||
case 14: | ||
case 13: | ||
_i8++; | ||
_context2.next = 3; | ||
_context2.next = 2; | ||
break; | ||
case 17: | ||
case 16: | ||
return _context2.abrupt("return", result); | ||
case 18: | ||
case 17: | ||
case "end": | ||
@@ -353,3 +347,3 @@ return _context2.stop(); | ||
} | ||
}, _callee2, this); | ||
}, _callee2); | ||
})); | ||
@@ -356,0 +350,0 @@ return _resolveTemplate.apply(this, arguments); |
@@ -125,3 +125,3 @@ "use strict"; | ||
mode: this.mode, | ||
itemIds: this.itemIds | ||
itemIds: Array.from(this.itemIds) | ||
}; | ||
@@ -128,0 +128,0 @@ } |
@@ -120,3 +120,3 @@ export class ItemSelection { | ||
mode: this.mode, | ||
itemIds: this.itemIds | ||
itemIds: Array.from(this.itemIds) | ||
}; | ||
@@ -123,0 +123,0 @@ } |
{ | ||
"name": "@medmain/core", | ||
"version": "0.1.32", | ||
"version": "0.1.33", | ||
"description": "Medmain's core module, root of everything else", | ||
@@ -5,0 +5,0 @@ "files": [ |
76153
2429