An open API service indexing awesome lists of open source software.

https://github.com/idiocc/append-field

[fork] W3C HTML JSON form compliant field appender Written In ES6 And Optimised With JavaScript Compiler.
https://github.com/idiocc/append-field

Last synced: about 1 year ago
JSON representation

[fork] W3C HTML JSON form compliant field appender Written In ES6 And Optimised With JavaScript Compiler.

Awesome Lists containing this project

README

          

# @goa/append-field

[![npm version](https://badge.fury.io/js/%40goa%2Fappend-field.svg)](https://npmjs.org/package/@goa/append-field)

`@goa/append-field` is a fork of [W3C HTML JSON form compliant field appender](https://github.com/LinusU/node-append-field) Written In ES6 And Optimised With [JavaScript Compiler](https://compiler.page).

A [W3C HTML JSON forms spec](http://www.w3.org/TR/html-json-forms/) compliant field appender (for lack of a better name). Useful for people implementing `application/x-www-form-urlencoded` and `multipart/form-data parsers`.

```sh
yarn add @goa/append-field
```

## Table Of Contents

- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`appendField(store: Object, key: string, value: string)`](#appendfieldstore-objectkey-stringvalue-string-void)
- [Copyright](#copyright)

## API

The package is available by importing its default function:

```js
import appendField from '@goa/append-field'
```

## `appendField(`
  `store: Object,`
  `key: string,`
  `value: string,`
`): void`

Adds the field named `key` with the value `value` to the object store.

```js
import appendField from '@goa/append-field'

const obj = {}

appendField(obj, 'pets[0][species]', 'Dahut')
appendField(obj, 'pets[0][name]', 'Hypatia')
appendField(obj, 'pets[1][species]', 'Felis Stultus')
appendField(obj, 'pets[1][name]', 'Billie')

console.log(obj)
```
```js
{ pets:
[ { species: 'Dahut', name: 'Hypatia' },
{ species: 'Felis Stultus', name: 'Billie' } ] }
```

## Copyright

Original Work by [Linus Unnebäck](https://github.com/LinusU/node-append-field).

---




Art Deco


© Art Deco for Idio 2019


Idio




Tech Nation Visa


Tech Nation Visa Sucks