diff --git a/README.md b/README.md index cd3f3c5..c09822c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The library uses [`@gravity-ui/unipika`](https://github.com/gravity-ui/unipika) - virtualization - two scroll modes: window scroll and container scroll -- collaps/expand objects/arrays +- collapse/expand objects/arrays - search substring of key/value (case-sensitive and case-insensitive) - render one literal per line - long strings are truncated by ellipsis @@ -64,7 +64,7 @@ function renderJson(data: any) { ## YSON notice The library does not support YSON-format "as is", i.e. it is impossible to use/parse YSON data. -But it provides the way to render JSON-objects as YSON, such JSON-objects has reserver field names like `$attributes`, `$value`. +But it provides the way to render JSON-objects as YSON, such JSON-objects has reserved field names like `$attributes`, `$value`. See more examples in [storybook](https://preview.yandexcloud.dev/react-unipika). diff --git a/src/utils/flattenUnipika.ts b/src/utils/flattenUnipika.ts index e9f6409..7a5e471 100644 --- a/src/utils/flattenUnipika.ts +++ b/src/utils/flattenUnipika.ts @@ -140,7 +140,7 @@ function flattenUnipikaJsonImpl(value: UnipikaValue, level = 0, ctx: FlatContext const itemPathIndex = isObjectLike(type) ? beforeAttrs - 1 : ctx.dst.length; const isCollapsed = isPathCollapsed(ctx); - const isContainerType = isValueContainenrType(value); + const isContainerType = isValueContainerType(value); let containerSize = 0; @@ -269,7 +269,7 @@ function flattenUnipikaYsonImpl(value: UnipikaValue, level = 0, ctx: FlatContext let hasAttributes = false; let valueLevel = level; - const isContainerType = isValueContainenrType(value); + const isContainerType = isValueContainerType(value); let containerSize = 0; const isCollapsed = isPathCollapsed(ctx); @@ -350,7 +350,7 @@ function popPath(ctx: FlatContext) { } } -function isValueContainenrType(value: UnipikaValue) { +function isValueContainerType(value: UnipikaValue) { return value.$type === 'map' || value.$type === 'list'; }