Skip to content

Q: Working with arrays in nested objects #39

@hinogi

Description

@hinogi

Taking the code from the modify example. Is it possible to just add elements to that array? Or how would you cover this example ?

const modified = pipe(
  { a: [{ b: 123 }] },
  modify('a.[number]', [{ test: 'abc'} , {a: 456]])
)
//  { a: [{ b: 123 }, {test: 'abc'} , {a: 456}] }

to give a broader look maybe you have something like the following

Cypress.Commands.add('mount', (component, options = {}) => {
  // Setup options object
  options.global = options.global || {}
  options.global.stubs = options.global.stubs || {}
  options.global.stubs['transition'] = false
  options.global.components = options.global.components || {}
  options.global.plugins = options.global.plugins || []

  /* Add any global plugins */
  // options.global.plugins.push(MyPlugin);

  /* Add any global components */
  // options.global.components['Button'] = Button;

  return mount(component, options)
})

and you just want to use modify on options without the boilerplate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions