numberToFixedSerializer.js — react Source File
Architecture documentation for numberToFixedSerializer.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
const MAX_DECIMAL_PLACES = 3;
// `test` is part of Jest's serializer API
export function test(maybeNumber) {
return (
typeof maybeNumber === 'number' &&
Number.isFinite(maybeNumber) &&
!Number.isInteger(maybeNumber) &&
!Number.isNaN(maybeNumber)
);
}
// print() is part of Jest's serializer API
export function print(number, serialize, indent) {
const string = number.toString();
const pieces = string.split('.');
if (pieces.length === 2) {
if (pieces[1].length > MAX_DECIMAL_PLACES) {
return number.toFixed(MAX_DECIMAL_PLACES);
}
}
return string;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does numberToFixedSerializer.js do?
numberToFixedSerializer.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in numberToFixedSerializer.js?
numberToFixedSerializer.js defines 2 function(s): print, test.
Where is numberToFixedSerializer.js in the architecture?
numberToFixedSerializer.js is located at packages/react-devtools-shared/src/__tests__/__serializers__/numberToFixedSerializer.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/__tests__/__serializers__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free