New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

serialize-form

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialize-form

A form serializer for Ender.JS / jQuery / etc

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

form-serializer

ender add form-serializer

var serializeForm = require('form-serializer').serializeFormObject
  , toNativeTypes = true
  , obj
  ;

obj = serializeForm('form#save-data', toNativeTypes);
// `true` means "try to convert to native types"
// Supported Types: Numbers, Boolean, and null

console.log(obj);

API

Okay, so serialize is a terrible prefix. jQuery talked fancy to me. I got confused!

serializeing a form, in this case, means to go from DoM to JavaScript, not from Object to Text.

An optional second parameter will cause the values to be typecasted. Supported Types: Numbers, Boolean, and null.

  • serializeFormObject

    • does not allow duplicate keys - [name=foobar]

    • does turn [name="waldo[]"] into an array

          {
              "foobar": "baz"
            , "grault": "garply"
            , "waldo": ["qux", "quux"]
          }
      
  • serializeFormArray

    • true representation of the form

          [
              {
                  "name": "foobar"
                , "value": "baz"
              }
            , {
                  "name": "waldo[]"
                , "value": "qux"
              }
          ]
      

License

Copyright AJ ONeal 2011

This project is available under the MIT and Apache v2 licenses.

  • http://www.opensource.org/licenses/mit-license.php
  • http://www.apache.org/licenses/LICENSE-2.0.html

FAQs

Package last updated on 13 Apr 2013

Did you know?

Socket

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