Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

182
Vistas
TypeError: Cannot read property 'fraction' of undefined - Cypress/Javascript

I am doing a test where I grab an odds value and store it as a fraction. Then I want to compare the value to a particular format depending on the option selected from the drop down.

I am trying to use these to set up the fraction and determine the odds format:

https://mathjs.org/docs/datatypes/fractions.html

How do I resolve that type error above.

Screenshot:

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If you want to use just fraction you can use:

const { fraction } = require("mathjs");

//In your test
fraction(oddsValue);

If you want to use others as well, you can do:

import { create, all } from "mathjs"
const math = create(all, {})

//In your test
math.fraction(oddsValue)
about 4 years ago · Juan Pablo Isaza Denunciar

0

The mathjs has no default export, so you import everything (*) and then name it in your import

import * as math from 'mathjs'

This is the main entry point for the mathjs package.

// configuration
export { config } from './configReadonly.js'

// functions and constants
export * from './pureFunctionsAny.generated.js'
export * from './impureFunctionsAny.generated.js'
export * from './typeChecks.js'

// error classes
export { IndexError } from '../error/IndexError.js'
export { DimensionError } from '../error/DimensionError.js'
export { ArgumentsError } from '../error/ArgumentsError.js'

// dependency groups
export * from './dependenciesAny.generated.js'

// factory functions
export * from '../factoriesAny.js'

// core
export { create } from '../core/create.js'
export { factory } from '../utils/factory.js'

If it had a default export, there would be

export default {
  function1,
  function2,
  function3,
  ...
}

and then you can import it without using * as math.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda