@8base/utils
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.4.0](https://github.com/8base/sdk/compare/v2.3.0...v2.4.0) (2021-08-17) | ||
### Bug Fixes | ||
* **utils:** rid redundant data at formatDataForMutations ([1e6b60b](https://github.com/8base/sdk/commit/1e6b60b0a22a75aee22f247401323dc87340775d)) | ||
# [2.3.0](https://github.com/8base/sdk/compare/v2.2.0...v2.3.0) (2021-08-10) | ||
@@ -8,0 +19,0 @@ |
@@ -107,2 +107,8 @@ "use strict"; | ||
} | ||
if (typeof formatedFieldData === 'string' && formatedFieldData === initialFieldData) { | ||
return result; | ||
} | ||
if (Array.isArray(formatedFieldData) && R.equals(formatedFieldData, initialFieldData)) { | ||
return result; | ||
} | ||
return Object.assign(Object.assign({}, result), { [fieldName]: formatedFieldData }); | ||
@@ -109,0 +115,0 @@ }, {}, dataKeys); |
@@ -58,4 +58,5 @@ "use strict"; | ||
initialData: item.initialData, | ||
initialListData: initialData, | ||
}, options)), R.filter((item) => Boolean(item)), R.groupBy(R.prop('type')), R.mapObjIndexed(R.map(R.prop('data'))))(data); | ||
exports.formatFieldDataList = formatFieldDataList; | ||
//# sourceMappingURL=formatFieldDataList.js.map |
@@ -6,4 +6,5 @@ import { MutationType, FieldSchema, Schema, FormatDataForMutationOptions } from '../types'; | ||
initialData?: any; | ||
initialListData?: any; | ||
} | ||
export declare const formatFieldDataListItem: (type: MutationType, data: any, { fieldSchema, schema, initialData }: IFormatFieldDataListItemMeta, options?: FormatDataForMutationOptions | undefined) => { | ||
export declare const formatFieldDataListItem: (type: MutationType, data: any, { fieldSchema, schema, initialData, initialListData }: IFormatFieldDataListItemMeta, options?: FormatDataForMutationOptions | undefined) => { | ||
type: string; | ||
@@ -10,0 +11,0 @@ data: unknown; |
@@ -29,3 +29,3 @@ "use strict"; | ||
const errors_1 = require("../errors"); | ||
const formatFieldDataListItem = (type, data, { fieldSchema, schema, initialData }, options) => { | ||
const formatFieldDataListItem = (type, data, { fieldSchema, schema, initialData, initialListData }, options) => { | ||
let nextData = data; | ||
@@ -48,2 +48,5 @@ if (R.isNil(nextData)) { | ||
if (typeof nextData === 'string') { | ||
if (Array.isArray(initialListData) && initialListData.includes(nextData)) { | ||
return null; | ||
} | ||
return { | ||
@@ -50,0 +53,0 @@ data: { id: nextData }, |
{ | ||
"name": "@8base/utils", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"repository": "https://github.com/8base/sdk", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/8base/sdk/tree/master/packages/core/utils", |
@@ -134,2 +134,10 @@ import * as R from 'ramda'; | ||
if (typeof formatedFieldData === 'string' && formatedFieldData === initialFieldData) { | ||
return result; | ||
} | ||
if (Array.isArray(formatedFieldData) && R.equals(formatedFieldData, initialFieldData)) { | ||
return result; | ||
} | ||
return { | ||
@@ -136,0 +144,0 @@ ...result, |
@@ -66,2 +66,3 @@ import * as R from 'ramda'; | ||
initialData: item.initialData, | ||
initialListData: initialData, | ||
}, | ||
@@ -68,0 +69,0 @@ options, |
@@ -14,2 +14,3 @@ import * as R from 'ramda'; | ||
initialData?: any; | ||
initialListData?: any; | ||
} | ||
@@ -20,3 +21,3 @@ | ||
data: any, | ||
{ fieldSchema, schema, initialData }: IFormatFieldDataListItemMeta, | ||
{ fieldSchema, schema, initialData, initialListData }: IFormatFieldDataListItemMeta, | ||
options?: FormatDataForMutationOptions, | ||
@@ -45,2 +46,6 @@ ) => { | ||
if (typeof nextData === 'string') { | ||
if (Array.isArray(initialListData) && initialListData.includes(nextData)) { | ||
return null; | ||
} | ||
return { | ||
@@ -47,0 +52,0 @@ data: { id: nextData }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
330385
5300