denoland / deno_std

The Deno Standard Library
https://jsr.io/@std
MIT License
2.83k stars 582 forks source link

BREAKING(yaml): rename `ParseOptions.json` to `ParseOptions.allowDuplicateKeys` #5282

Closed iuioiua closed 3 days ago

iuioiua commented 3 days ago

What's changed

ParseOptions.json has been renamed ParseOptions.allowDuplicateKeys. This change only affects those that previously set ParseOptions.json to true. No changes in behavior have been made.

Motivation

This name more clearly describes how the option affects the behavior of parse().

Migration guide

To migrate, use the allowDuplicateKeys option instead of the json option for parse().

import { parse } from "@std/yaml/parse";

const yamlString = `name: John Doe
age: 30
name: Jane Doe`;

- parse(yamlString, { json: true });
+ parse(yamlString, { allowDuplicateKeys: true });

Related

Towards #5195

codecov[bot] commented 3 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.76%. Comparing base (fc2975b) to head (7cc1684).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #5282 +/- ## ======================================= Coverage 95.76% 95.76% ======================================= Files 457 457 Lines 37955 37955 Branches 5569 5569 ======================================= Hits 36346 36346 Misses 1568 1568 Partials 41 41 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kt3k commented 3 days ago

I'm in favor of this change. The option name json doesn't describe what it changes.

I slightly feel allowDuplicatedKeys is a bit more natural. What do you think?

iuioiua commented 3 days ago

I slightly feel allowDuplicatedKeys is a bit more natural. What do you think?

I don't think it's any more natural than what it is now.

iuioiua commented 3 days ago

I did a quick search - "duplicate keys" seems more correct.