Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@8base/utils

Package Overview
Dependencies
Maintainers
2
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@8base/utils - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

src/verifiers/isEmptyNumber.js

31

lib/utils.js

@@ -225,2 +225,6 @@ (function webpackUniversalModuleDefinition(root, factory) {

var isEmptyAddress = external_ramda_["anyPass"]([isEmpty, external_ramda_["allPass"]([external_ramda_["propSatisfies"](isEmpty, 'street1'), external_ramda_["propSatisfies"](isEmpty, 'street2'), external_ramda_["propSatisfies"](isEmpty, 'zip'), external_ramda_["propSatisfies"](isEmpty, 'city'), external_ramda_["propSatisfies"](isEmpty, 'state'), external_ramda_["propSatisfies"](isEmpty, 'country')])]);
// CONCATENATED MODULE: ./src/verifiers/isEmptyNumber.js
var isEmptyNumber = external_ramda_["anyPass"]([external_ramda_["isEmpty"], external_ramda_["isNil"]]);
// CONCATENATED MODULE: ./src/verifiers/isFileField.js

@@ -247,2 +251,11 @@

// CONCATENATED MODULE: ./src/verifiers/isNumberField.js
var isNumberField = external_ramda_["propEq"]('fieldType', FIELD_TYPE.NUMBER);
// CONCATENATED MODULE: ./src/verifiers/isRelationField.js

@@ -264,2 +277,4 @@

// CONCATENATED MODULE: ./src/formatters/formatFieldDataListItem.js

@@ -355,2 +370,16 @@

}
} else if (isNumberField(fieldSchema)) {
if (isListField(fieldSchema)) {
if (Array.isArray(nextData)) {
nextData = external_ramda_["reject"](isEmptyNumber, nextData);
nextData = external_ramda_["map"](Number, nextData);
}
} else {
if (isEmptyNumber(nextData)) {
nextData = null;
} else {
nextData = Number(nextData);
}
}
}

@@ -522,5 +551,7 @@

/* concated harmony reexport isEmptyAddress */__webpack_require__.d(__webpack_exports__, "isEmptyAddress", function() { return isEmptyAddress; });
/* concated harmony reexport isEmptyNumber */__webpack_require__.d(__webpack_exports__, "isEmptyNumber", function() { return isEmptyNumber; });
/* concated harmony reexport isFileField */__webpack_require__.d(__webpack_exports__, "isFileField", function() { return isFileField; });
/* concated harmony reexport isListField */__webpack_require__.d(__webpack_exports__, "isListField", function() { return isListField; });
/* concated harmony reexport isMetaField */__webpack_require__.d(__webpack_exports__, "isMetaField", function() { return isMetaField; });
/* concated harmony reexport isNumberField */__webpack_require__.d(__webpack_exports__, "isNumberField", function() { return isNumberField; });
/* concated harmony reexport isRelationField */__webpack_require__.d(__webpack_exports__, "isRelationField", function() { return isRelationField; });

@@ -527,0 +558,0 @@

4

package.json
{
"name": "@8base/utils",
"version": "0.8.0",
"version": "0.8.1",
"main": "lib/utils.js",

@@ -22,3 +22,3 @@ "scripts": {

"devDependencies": {
"@8base/webpack-configuration": "^0.8.0",
"@8base/webpack-configuration": "^0.8.1",
"babel-cli": "^6.26.0",

@@ -25,0 +25,0 @@ "babel-core": "^6.26.3",

//@flow
import * as R from 'ramda';
import { isListField, isFileField, isRelationField, isAddressField, isEmptyAddress } from '../verifiers';
import * as verifiers from '../verifiers';
import { formatFieldDataList } from './formatFieldDataList';

@@ -13,4 +13,4 @@ import { formatFieldData } from './formatFieldData';

if (isFileField(fieldSchema) || isRelationField(fieldSchema)) {
if (isListField(fieldSchema)) {
if (verifiers.isFileField(fieldSchema) || verifiers.isRelationField(fieldSchema)) {
if (verifiers.isListField(fieldSchema)) {
nextData = formatFieldDataList(type, fieldSchema, data, schema);

@@ -20,12 +20,26 @@ } else {

}
} else if (isAddressField(fieldSchema)) {
if (isListField(fieldSchema)) {
} else if (verifiers.isAddressField(fieldSchema)) {
if (verifiers.isListField(fieldSchema)) {
if (Array.isArray(nextData)) {
nextData = R.reject(isEmptyAddress, nextData);
nextData = R.reject(verifiers.isEmptyAddress, nextData);
}
} else {
if (isEmptyAddress(nextData)) {
if (verifiers.isEmptyAddress(nextData)) {
nextData = null;
}
}
} else if (verifiers.isNumberField(fieldSchema)) {
if (verifiers.isListField(fieldSchema)) {
if (Array.isArray(nextData)) {
nextData = R.reject(verifiers.isEmptyNumber, nextData);
nextData = R.map(Number, nextData);
}
} else {
if (verifiers.isEmptyNumber(nextData)) {
nextData = null;
} else {
nextData = Number(nextData);
}
}
}

@@ -32,0 +46,0 @@

export { isAddressField } from './isAddressField';
export { isEmptyAddress } from './isEmptyAddress';
export { isEmptyNumber } from './isEmptyNumber';
export { isFileField } from './isFileField';
export { isListField } from './isListField';
export { isMetaField } from './isMetaField';
export { isNumberField } from './isNumberField';
export { isRelationField } from './isRelationField';

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc