@8base/utils
Advanced tools
Comparing version 0.4.4 to 0.4.5
@@ -8,4 +8,6 @@ import { MUTATION_TYPE } from '../constants'; | ||
if (Array.isArray(formatedData)) { | ||
formatedData = formatedData.map(function (id) { | ||
return { id: id }; | ||
formatedData = formatedData.map(function (item) { | ||
return { | ||
id: typeof item === 'string' ? item : item.id || item | ||
}; | ||
}); | ||
@@ -12,0 +14,0 @@ } else { |
@@ -1,1 +0,2 @@ | ||
export { formatDataForMutation } from './formatDataForMutation'; | ||
export { formatDataForMutation } from './formatDataForMutation'; | ||
export { formatDataAfterQuery } from './formatDataAfterQuery'; |
@@ -5,5 +5,5 @@ import { isRelationField } from './isRelationField'; | ||
var isRelationReference = function isRelationReference(fieldSchema, data) { | ||
return isRelationField(fieldSchema) && (typeof data === 'string' || Array.isArray(data) && (data.length === 0 || typeof data[0] === 'string')); | ||
return isRelationField(fieldSchema) && (typeof data === 'string' || Array.isArray(data) && (data.length === 0 || typeof data[0] === 'string') || Array.isArray(data) && (data.length === 0 || typeof data[0].id === 'string')); | ||
}; | ||
export { isRelationReference }; |
{ | ||
"name": "@8base/utils", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"main": "es/index.js", | ||
@@ -35,3 +35,3 @@ "module": "es/index.js", | ||
}, | ||
"gitHead": "07f81e66445dc55d1d305c362ddd32db085085b0" | ||
"gitHead": "84ec2d36a57614c25d3deb20ae613a26fd19fbed" | ||
} |
@@ -9,3 +9,5 @@ //@flow | ||
if (Array.isArray(formatedData)) { | ||
formatedData = formatedData.map((id) => ({ id })); | ||
formatedData = formatedData.map((item) => ({ | ||
id: typeof item === 'string' ? item : (item.id || item), | ||
})); | ||
} else { | ||
@@ -12,0 +14,0 @@ formatedData = { |
export { formatDataForMutation } from './formatDataForMutation'; | ||
export { formatDataAfterQuery } from './formatDataAfterQuery'; |
@@ -16,2 +16,8 @@ //@flow | ||
) | ||
|| | ||
( | ||
Array.isArray(data) | ||
&& | ||
(data.length === 0 || typeof data[0].id === 'string') | ||
) | ||
) | ||
@@ -18,0 +24,0 @@ ); |
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
2380629
116
16403