{"id":21524897,"url":"https://github.com/degjs/formmapper","last_synced_at":"2025-03-17T18:17:56.773Z","repository":{"id":29302782,"uuid":"121300064","full_name":"DEGJS/formMapper","owner":"DEGJS","description":"utility to get the values of form inputs","archived":false,"fork":false,"pushed_at":"2023-01-06T18:33:52.000Z","size":1245,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-23T09:45:38.470Z","etag":null,"topics":["forms"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEGJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-12T20:48:59.000Z","updated_at":"2021-09-07T06:32:37.000Z","dependencies_parsed_at":"2023-01-14T14:38:06.118Z","dependency_job_id":null,"html_url":"https://github.com/DEGJS/formMapper","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformMapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformMapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformMapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformMapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEGJS","download_url":"https://codeload.github.com/DEGJS/formMapper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085010,"owners_count":20395523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forms"],"created_at":"2024-11-24T01:30:22.645Z","updated_at":"2025-03-17T18:17:56.748Z","avatar_url":"https://github.com/DEGJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# formMapper\n![Run Tests](https://github.com/DEGJS/formMapper/workflows/Run%20Tests/badge.svg)\n\nA utility to take in an element or array of elements and return an object consisting of their values\n\n## Install\nformMapper is an ES6 module. Consequently, you'll nee an ES6 transpiler ([Babel](https://babeljs.io) is an option) as part of your Javascript workflow.\n\nIf you are already using NPM for your project, you can install formMapper with the following command:\n\n```\n$ npm install @degjs/form-mapper\n```\n\n## Usage \n### Importing individual methods:\n```\nimport { getValues } from \"@degjs/form-mapper\";\n.\n.\n.\nconst formData = getValues(formEl);\n```\n\n### Importing all methods:\n```\nimport formMapper from \"@degjs/form-mapper\";\n.\n.\n.\nconst formData = formMapper.getValues(formEl);\n```\n\n## DefaultElementSelectors\nThe options represent the default selector names for various input elements. Can be replaced with a string of any selectors that `querySelectAll` and `matches` supports.\n\nDefault: `input, select, textarea`\nExample override: `.js-input, .js-checkbox-input, select[multiple], textarea`\n\n## Methods\n\n### getValues(input, opts)\nThe getValues method returns an object with key value pairs being { inputName: inputValue }\n\n#### input\nType: `Element | Element[]`\nThe container element, input element or array of elements to get values from.\n\n#### opts\nType: `Object`   \nDefault: `{elementSelectors: defaultElementSelectors, shouldStringify: false, shouldReturnAllCheckboxVals: false}`\nAn object to override the default settings.  \n`shouldStringify` declares if the returned value should be a string representation of an object or just the object.  \n`shouldReturnAllCheckboxVals` declares if checkbox groups (i.e., multiple inputs with the same name) should return an array of only \"checked\" values, or an object of all inputs with a boolean value.\n\n### getInputElements(formEl, selectorSettings)\nThe getInputElements method returns an array of input elements as found by the default selectors.\n\n#### formEl\nType: `Element`\nThe form element to extract inputs from.\n\n#### selectorSettings\nType: `String`\nDefault: `defaultElementSelectors`\nAnd string representing a comma-separated list of selectors to override any default element selectors.\n\n## Browser Support\nformMapper depends on the following browser APIs:\n\n+ matches: [Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) | [Polyfill](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill)\n\nAs of Febrary 2018, matches is supported in IE9 and up.\n\nTo support legacy browsers, you'll need to include polyfills for the above APIs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fformmapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegjs%2Fformmapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fformmapper/lists"}