
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
A vanilla-JS financial amount input control. Supports the following features:
The below table lists features that finput requires in order to function properly. If you wish to use finput with a browser that does not support a required feature then using the suggested polyfill may help. Note that there may be more appropriate polyfills than the ones listed.
| Required Feature | Suggested Polyfill |
|---|---|
| KeyboardEvent.key | keyboardevent-key-polyfill |
| Symbol | babel-polyfill |
See an example finput here
npm install finput
To initialise the finput, simply pass the element and any options into the finput constructor. An object is returned which allows you to interact with the finput API.
Type: Number
Default: 2
Maximum number of decimal digits the value can take
Type: string
Default: ALL
The possible range of values that the value can take
Possible Values:
'ALL': Number can take any value'POSITIVE': Number can only be positiveType: Boolean
Default: true
If true, after focus is lost value is formatted to scale number of decimal places
Type: string
Default: ,
The character used to separate thousands in the formatted value.
E.g. 1,000
Type: string
Default: .
The character used for the decimal point
Type: Object { character: multiplier }
Default: { 'k': 1000, 'm': 1000000, 'b': 1000000000 }
An object mapping of shortcuts that the user can use to quickly enter common values.
E.g. with the default shortcuts, typing k will multiply the number value by 1000
Type: Function(e)
Default: () => {}
A callback function that is fired each time a invalid key is pressed.
the callback is called with the KeyboardEvent object that was raised on keydown.
Type: Function(e)
Default: undefined
A callback function that is fired each time the input is focussed.
the callback is called with the Event object.
the function used needs to return an object with a start and end value, a numerical representation of the postions to select.
{ start: 0, end: 1 }
setting both values to 0 or failing to return both values will disable selecting functionality
The following properties are exposed on the returned finput instance:
Retrieves the options on the input
Retrieves the raw value of the input (numerical)
Retrieves the formatted value of the input (string)
The following functions are exposed on the returned finput instance:
Sets the options on the input
options New options to set. Copied before being set.Note that setOptions supplements the current options rather than replacing.
element.setOptions({ thousands: '.' });
element.setOptions({ decimal: ',' });
The above therefore results in the following options:
{
thousands: '.',
decimal: ','
}
Sets the value, fully formatted, for the input
val New value to setnotNull When true, restricts setting the value if it is null.Sets and formats the value for the input
val New value to setRemoves finputs listeners from the provided element, returning it to a standard native control
Install dependencies:
npm installAdding dependencies:
yarn.lockpackage-lock.jsonRun dev server:
npm startnpm run build:dev - Builds a development friendly version of the applicationnpm run build:prod - Builds a minified version of the applicationnpm run compile - Compiles typescript dependency-free version of libraryExecute the tests locally:
npm testThis takes care of doing the following:
The tests can be run for CI using:
npm run test:ciThis is the same as npm test but it does not update or start webdriver. We assume that CI/Browserstack takes care of webdriver for us.
semantic-release is used with Travis CI to perform releases on merged PRs to master branch.
Commit messages must follow AngularJS Commit Message Conventions for semantic-release to correctly choose the next version.
If the Travis CI build for a new release is successful, it is published to npm.
./lib/finput.js is used by npm installs, and ./dist/finput.min.js is
automatically served by UNPKG CDN at https://unpkg.com/finput@latest/dist/finput.min.js to directly load finput
in a browser environment.
FAQs
A vanilla-JS financial amount input control
We found that finput 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
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.