Socket
Socket
Sign inDemoInstall

final-form-arrays

Package Overview
Dependencies
3
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    final-form-arrays

Array Mutators for 🏁 Final Form


Version published
Maintainers
1
Created

Readme

Source

🏁 Final Form Arrays

NPM Version NPM Downloads Build Status codecov.io styled with prettier

Mutators for updating array fields in 🏁 Final Form.


Installation

npm install --save final-form-arrays

or

yarn add final-form-arrays

Usage

import { createForm } from 'final-form'
import arrayMutators from 'final-form-arrays'

// Create Form
const form = createForm({
  mutators: { ...arrayMutators },
  onSubmit
})

// push
form.mutators.push('customers', { firstName: '', lastName: '' })

// pop
const customer = form.mutators.pop('customers')

Table of Contents

Mutators

form.mutators.insert(name: string, index:number, value: any) => undefined

Inserts a value into the specified index of the array field.

form.mutators.move(name: string, from: number, to: number) => undefined

Moves a value from one index to another index in the array field.

form.mutators.pop(name: string) => any

Pops a value off the end of an array field. Returns the value.

form.mutators.push(name: string, value: any) => void

Pushes a value onto the end of an array field.

form.mutators.remove(name: string, index: number) => any

Removes a value from the specified index of the array field. Returns the removed value.

form.mutators.shift(name: string) => any

Removes a value from the beginning of the array field. Returns the value.

form.mutators.swap(name: string, indexA: number, indexB: number) => void

Swaps the position of two values in the array field.

form.mutators.unshift(name: string, value: any) => void

Inserts a value onto the beginning of the array field.

FAQs

Last updated on 23 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc