blakeembrey / blakeembrey/javascript-stringify
allow identifier when maxDepth/maxValues is hit
- 主要言語
- TypeScript
- スター
- 146
- フォーク
- 16
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
ファイルまたはテストのパスは指定されていません。stringify のエントリーポイントと現在の maxDepth/maxValues の処理を見つけ、提案されているカスタムテキストとフラグのオプションを比較してから、切り詰められた値と本当に空の値または undefined の値を区別するテストカバレッジを追加し、例の出力を検証してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100