
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
form-mutator
Advanced tools
A utility to fill out web form and mutate field data programmatically.
You can download compressed copy for browser usage.
$ npm install --save form-mutator
Provide utility to fill out web form and mutate field data programmatically.
Example (Browser usage)
<script type="text/javascript" src="form-mutator.min.js"></script>
<script>
formMutator.fillOut({
'[name="fullName"]': 'Your Name',
'[name="address"]': '1 Awesome Way',
'[name="city"]': 'Lalaland',
'[type="submit"]': true,
});
</script>
Example (Node.js usage)
const formMutator = require('form-mutator');
formMutator.fillOut({
'[name="fullName"]': 'Your Name',
'[name="address"]': '1 Awesome Way',
'[name="city"]': 'Lalaland',
'[type="submit"]': true,
});
booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanClick on given element.
Kind: static property of form-mutator
Returns: boolean - Truthy if click triggered, otherwise falsy.
| Param | Type | Description |
|---|---|---|
| element | Object | The element to click. |
Example
const el = document.querySelector('a[href="/"]');
const response = formMutator.click(el);
booleanDeselect given values from dropdown list.
Kind: static property of form-mutator
Returns: boolean - Truthy if deselect triggered, otherwise falsy.
| Param | Type | Description |
|---|---|---|
| element | Object | The element to deselect from. |
| values | Array.<string> | The values to deselect. |
Example
const el = document.querySelector('[name="month"]');
const response = formMutator.deselectByText(el, ['January']);
booleanFill out all form field matched given selector => value key-pair. It will skip unknown field type and missing field.
Kind: static property of form-mutator
Returns: boolean - Truthy if the values are set, otherwise false.
| Param | Type | Description |
|---|---|---|
| data | Object | The selector => value data map. |
| data.selector | string | The selector to find desired element. |
| data.value | mixed | The value to be set. |
Example
const response = formMutator.fillOut({
'[name="fullName"]': 'Your Name',
'[name="address"]': '1 Awesome Way',
'[name="city"]': 'Lalaland',
'[type="submit"]': true,
});
booleanSelect given values from dropdown list.
Kind: static property of form-mutator
Returns: boolean - Truthy if select triggered, otherwise falsy.
| Param | Type | Description |
|---|---|---|
| element | Object | The element to select from. |
| values | Array.<string> | The values to select. |
Example
const el = document.querySelector('[name="month"]');
const response = formMutator.selectByText(el, ['January']);
booleanSet given value to input field that match given selector.
Kind: static property of form-mutator
Returns: boolean - Truthy if the value is set, or the field is unknown type
or the field can not be found, otherwise false.
| Param | Type | Description |
|---|---|---|
| selector | string | The selector to find desired element. |
| value | mixed | The value to be set. |
Example
const response = formMutator.setValue('[type="text"]', 'value');
booleanToggle the checkbox or radio button field.
Kind: static property of form-mutator
Returns: boolean - Truthy if toggle triggered, otherwise falsy.
| Param | Type | Description |
|---|---|---|
| element | Object | The element to toggle from. |
| value | boolean | Check if true, otherwise uncheck. |
Example
const el = document.querySelector('[type="checkbox"]');
const response1 = formMutator.toggleCheckbox(el, true); // checked
const response2 = formMutator.toggleCheckbox(el, false); // unchecked
booleanType given value to password or text field.
Kind: static property of form-mutator
Returns: boolean - Truthy if type in triggered, otherwise falsy.
| Param | Type | Description |
|---|---|---|
| element | Object | The element to type on. |
| value | mixed | The value to be typed in. |
Example
const el = document.querySelector('[type="text"]');
const response = formMutator.typeValue(el, 'value');
You will need to install Node.js as a local
development dependency. The npm package manager comes bundled with all
recent releases of Node.js.
npm install will attempt to resolve any npm module dependencies that have
been declared in the project’s package.json file, installing them into the
node_modules folder.
$ npm install
To make sure we followed code style best practice, run:
$ npm run lint
To make sure we did not break anything, let's run:
$ npm test
If you would like to contribute code to Form Mutator repository you can do so through GitHub by forking the repository and sending a pull request.
If you do not agree to Contribution Agreement, do not contribute any code to Form Mutator repository.
When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also include appropriate test cases.
That's it! Thank you for your contribution!
Copyright (c) 2018 - 2020 Richard Huang.
This utility is free software, licensed under: Mozilla Public License (MPL-2.0).
Documentation and other similar content are provided under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
FAQs
A utility to fill out web form and mutate field data programmatically.
We found that form-mutator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.