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