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

factorial-form

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factorial-form - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

coverage/clover.xml

35

__tests__/Form.spec.js

@@ -6,2 +6,3 @@ import { Form } from '../src'

name: 'paco',
active: true,
age: 0,

@@ -19,2 +20,3 @@ price: 0,

price: 'cents',
active: 'boolean',
country_metadata: {

@@ -63,2 +65,3 @@ social_security: 'string'

name: 'paco',
active: true,
age: '0',

@@ -79,2 +82,34 @@ price: '0',

describe('when a boolean field is missing', () => {
beforeEach(() => {
const newAttr = {
id: 1,
name: 'paco',
age: 0,
price: 0,
country_metadata: {
social_security: '1234'
}
}
form = new Form(newAttr, types)
})
it('returns false', () => {
expect(form.isComplete).toBe(false)
})
})
describe('when a boolean field is empty', () => {
beforeEach(() => form.setValues({active: ''}))
it('returns false', () => {
expect(form.isComplete).toBe(false)
})
})
describe('when a boolean field is null', () => {
beforeEach(() => form.setValues({active: null}))
it('returns false', () => {
expect(form.isComplete).toBe(false)
})
})
describe('when all fields are complete', () => {

@@ -81,0 +116,0 @@ beforeEach(() => form.setValues({age: 0}))

4

lib/Form.js

@@ -294,5 +294,5 @@ 'use strict';

case 'number':
case 'cents':
case 'boolean':
case 'cents':
return _lodash2.default.isNull(field.value);
return field.value === '' || _lodash2.default.isNull(field.value);
default:

@@ -299,0 +299,0 @@ return !field.value;

{
"name": "factorial-form",
"version": "0.1.1",
"version": "0.1.2",
"description": "Factorial form library",

@@ -5,0 +5,0 @@ "repository": {

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