Skip to content

Round number.precision if options.convert #485

@dbrockman

Description

@dbrockman

If options.convert is true then it would be helpful if number.precision would round the value to the specified precision instead of rejecting it. Similar to how string converts to lower/upper case.

Example conversion:

// in number._base
if (options.convert && 'precision' in this._flags) {
  var precision = Math.pow(10, this._flags.precision);
  value = Math.round(value * precision) / precision;
}

Metadata

Metadata

Assignees

Labels

breaking changesChange that can breaking existing codefeatureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions