Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Working with arrays in nested objects #39

Open
hinogi opened this issue Dec 1, 2023 · 0 comments
Open

Q: Working with arrays in nested objects #39

hinogi opened this issue Dec 1, 2023 · 0 comments

Comments

@hinogi
Copy link

hinogi commented Dec 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant