mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-06 22:37:12 -04:00
fix(yaml viewer): handle numbers as bigint to avoid conversion to exponent
This commit is contained in:
parent
e68f743147
commit
ab6609ef7b
2 changed files with 5 additions and 2 deletions
1
src/tools/yaml-viewer/composeverter.d.ts
vendored
1
src/tools/yaml-viewer/composeverter.d.ts
vendored
|
@ -17,4 +17,5 @@ declare module 'composeverter' {
|
|||
export function migrateFromV2xToV3x(content: string, configuration?: Configuration = null): string;
|
||||
export function getDockerComposeSchemaWithoutFormats(): object;
|
||||
export function yamlParse(content: string): object;
|
||||
export function yamlCheck(content: string): object;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import { type MaybeRef, get } from '@vueuse/core';
|
||||
import { yamlParse } from 'composeverter';
|
||||
import { yamlCheck } from 'composeverter';
|
||||
import yaml from 'yaml';
|
||||
|
||||
export { formatYaml };
|
||||
|
@ -13,7 +13,9 @@ function formatYaml({
|
|||
sortKeys?: MaybeRef<boolean>
|
||||
indentSize?: MaybeRef<number>
|
||||
}) {
|
||||
const parsedYaml = yamlParse(get(rawYaml));
|
||||
const rawYamlString = get(rawYaml);
|
||||
yamlCheck(rawYamlString);
|
||||
const parsedYaml = yaml.parse(rawYamlString, { intAsBigInt: true });
|
||||
|
||||
const formattedYAML = yaml.stringify(parsedYaml, {
|
||||
sortMapEntries: get(sortKeys),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue