@8base/utils
Advanced tools
Comparing version 0.4.11 to 0.4.13
@@ -0,1 +1,3 @@ | ||
import * as R from 'ramda'; | ||
import { MUTATION_TYPE } from '../constants'; | ||
@@ -8,2 +10,4 @@ | ||
if (Array.isArray(formatedData)) { | ||
formatedData = R.reject(R.isNil, formatedData); | ||
formatedData = formatedData.map(function (item) { | ||
@@ -10,0 +14,0 @@ return { |
import * as R from 'ramda'; | ||
import { getFieldSchemaByName, getTableSchemaByName } from '../selectors'; | ||
import { isRelationField, isListField } from '../verifiers'; | ||
import { isRelationField, isFileField, isListField } from '../verifiers'; | ||
@@ -27,3 +27,3 @@ | ||
if (isRelationField(fieldSchema) && isListField(fieldSchema)) { | ||
if ((isRelationField(fieldSchema) || isFileField(fieldSchema)) && isListField(fieldSchema)) { | ||
if (data[fieldName]) { | ||
@@ -30,0 +30,0 @@ result = R.assoc(fieldName, data[fieldName].items, result); |
@@ -7,5 +7,5 @@ import * as R from 'ramda'; | ||
var isFileReference = function isFileReference(fieldSchema, data) { | ||
return isFileField(fieldSchema) && !R.isNil(data) && (typeof data === 'string' || data.length === 0 || typeof data[0] === 'string' || data && typeof data.id === 'string'); | ||
return isFileField(fieldSchema) && !R.isNil(data) && (typeof data === 'string' || data && typeof data.id === 'string' || Array.isArray(data) && (data.length === 0 || isFileReference(fieldSchema, data[0]))); | ||
}; | ||
export { isFileReference }; |
{ | ||
"name": "@8base/utils", | ||
"version": "0.4.11", | ||
"version": "0.4.13", | ||
"main": "es/index.js", | ||
@@ -5,0 +5,0 @@ "module": "es/index.js", |
//@flow | ||
import * as R from 'ramda'; | ||
import { MUTATION_TYPE } from '../constants'; | ||
@@ -9,2 +11,4 @@ import type { MutationType } from '../types'; | ||
if (Array.isArray(formatedData)) { | ||
formatedData = R.reject(R.isNil, formatedData); | ||
formatedData = formatedData.map((item) => ({ | ||
@@ -11,0 +15,0 @@ id: typeof item === 'string' ? item : (item.id || item), |
@@ -5,3 +5,3 @@ //@flow | ||
import { getFieldSchemaByName, getTableSchemaByName } from '../selectors'; | ||
import { isRelationField, isListField } from '../verifiers'; | ||
import { isRelationField, isFileField, isListField } from '../verifiers'; | ||
import type { FieldSchema, TableSchema, Schema } from '../types'; | ||
@@ -29,3 +29,3 @@ | ||
if (isRelationField(fieldSchema) && isListField(fieldSchema)) { | ||
if ((isRelationField(fieldSchema) || isFileField(fieldSchema)) && isListField(fieldSchema)) { | ||
if (data[fieldName]) { | ||
@@ -32,0 +32,0 @@ result = R.assoc(fieldName, data[fieldName].items, result); |
@@ -15,5 +15,15 @@ //@flow | ||
|| | ||
(data.length === 0 || typeof data[0] === 'string') | ||
( | ||
data && typeof data.id === 'string' | ||
) | ||
|| | ||
(data && typeof data.id === 'string') | ||
( | ||
Array.isArray(data) | ||
&& | ||
( | ||
data.length === 0 | ||
|| | ||
isFileReference(fieldSchema, data[0]) | ||
) | ||
) | ||
) | ||
@@ -20,0 +30,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
286997
646