blakeembrey / blakeembrey/javascript-stringify

allow identifier when maxDepth/maxValues is hit

Aberta
#42 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
146
Forks
16
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

currently when using maxDepth/ maxValue, there is no way to know if a item is an empty object/undefined or if its been truncated by this param, I propose adding either a custom text param, or at least a flag to set default text variables to tell the client that the data is truncated and not in fact empty/undefined

# max depth example
```
//currently
const obj = {"hello":{"world":{"i am":"an Object"}}}
stringify(obj,null,null,{maxDepth:2});
//outputs: '{hello:{world:{}}}'

// unknown if depth has been reached or if "world" key just goes to an empty object

//feature with same object
const str = "[JSON max depth has been reached]"
stringify(obj,null,null,{maxDepth:2, maxDepthText: str});
//outputs:'{hello:{world:[JSON max depth has been reached]}}'

```

# max value example
```
//currently
const obj2 = {"hello":{"world":{"i": "am","an": "Object"}, test1: true, test2:false}}
stringify(obj2,null,null,{maxValues:3});
//outputs:'{hello:{world:{}}}'

// unknown if value limt has been reached or if the value for the "hello" key just has an object with a "world" key

//feature with same object
const str = "max values for object reached"
stringify(obj,null,null,{maxValues:3, maxValuesText: str});
//outputs: '{hello:{world:{"..." : "max values for object reached" }, "...": "max values for object reached"}}'
// notice not "..." for both test1 and test2, just 1 "..." for the object that is missing keys
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

No file or test path is named. Locate the stringify entry point and current maxDepth/maxValues handling, compare the proposed custom text and flag options, then add coverage distinguishing truncated values from genuinely empty or undefined values and verify the example outputs.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, typescript
Domínio
tooling
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.