Skip to content

"-0" throw number.unsafe #2091

@zapolnoch

Description

@zapolnoch

Context

  • node version: 12.6.0
  • joi version: 15.1.1
  • environment: node
  • used with: standalone

What are you trying to achieve or the steps to reproduce ?

const schema = Joi.number()
const result = schema.validate('-0')

Which result you had ?

error type 'number.unsafe'

What did you expect ?

{ error: null, value: 0 }

because:

const schema = Joi.number()
schema.validate('+0') // => { error: null, value: 0 }

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions