
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
nv-format is a numeric value formatter. This tool serves for defining a string representation of a number.
var result = nvFormat
({/*optionalSettings*/}, optionalNotRetainInstance)
(number, optionalFormatString, {/*optionalParameters*/});
var result = nvFormat
({/*optionalParameters*/}, optionalNotRetainInstance)
(number, {/*optionalSettings*/});
nvFormat
()(123.537, "d.dd", { trunc: "round" });
//123.54
nvFormat
()(123.537, "d", { trunc: "round" });
//124
nvFormat
()(123.537, "xd", { trunc: "round" });
//24
nvFormat
({ format: "ddddddd.d", delimiter: "," })
(1123.537);
//0,001,123.5
nvFormat
({ format: "ddddddd.d", delimiter: "r," })
(1123.537);
//0001,123.5
nvFormat
({ format: "ddddddd.d", delimiter: "r," })
(1123.537, "d");
//1,123
nvFormat
({ format: "ddddddd.d", delimiter: "r," })
(1123.537, { format: "ddddddd.d", delimiter: "," });
//0,001,123.5
nvFormat
({ format: "d.25", trunc: "floor" })
(1123.537);
//1123.50
nvFormat
({ format: "d.25", trunc: "ceil" })
(1123.537);
//1123.75
nvFormat
({ format: "$(dd00).--", trunc: "floor" })
(1123.537);
//$1100.--
nvFormat
({ format: "$(dd00).--", trunc: "ceil" })
(1123.537);
//$1200.--
nvFormat
()(23.537, "dddd.25");
//0023.50
nvFormat
()(23.537, "ddd1.25");
//0022.50
nvFormat
()(23.537, "ddd1.25", { trunc: "ceil" });
//0023.75
var nF = nvFormat({ format: "(dd,dd)%" }, true);
nF(12.2) //12,20%
nF(5) //05,00%
nF(123.537) //123,53%
var nvFormat = require('nv-format'); /*OR*/
var nvFormat = require('./umd/nv-format.min.js'); /*OR*/
var nvFormat = require('./umd/nv-format.js');
import nvFormat from 'nv-format/esm'; /*OR*/
import nvFormat from './esm/nv-format.js';
<script src="./src/nv-format.min.js"></script> <!--OR-->
<script src="./src/nv-format.js"></script> <!--OR-->
<script src="./umd/nv-format.min.js"></script> <!--OR-->
<script src="./umd/nv-format.js"></script>
import nvFormat from './esm/nv-format.js';
Note: Here "./" represents the package's root directory
A call to the function that represents that tools (i.g. nvFormat) accept an object containing some set of settings that overwrites default ones. It returns a function bound to the resulting settings and that function factually performs formatting. It accepts a number to format as its first argument. A format string can be passed via the 'format' property of the settings object or as the second argument of the formatting function. It is possible to overwrite those setting the function was bound to by passing a settings object as the third argument when a format string is passed as the second argument, or as the second argument when the format string parameter is omitted. By default after a function bound to some settings is created, it will be retained in case a function bound to such settings set will again be requested to return one already created. It is possible to prevent this behavior by passing a true value as the second parameter. It is also possible to remove all links to the currently retained functions by passing a string 'clear' as the first parameter of the entry point function.
var defaultSettings = {
trunc: "floor",
filler: "0",
format: "d",
point: "",
delimiter: "",
prefix: "",
postfix: "",
output: "",
};
FAQs
A tool for defining a string representation of a number
We found that nv-format 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.