CacheControl / CacheControl/json-rules-engine

Cannot convert object to primitive value

未关闭
#309 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
3.1k
派生
507
PR 合并指标
30 天内没有已合并 PR

描述

In `almanac` you have debug lines like this:
```js
(0, _debug2.default)('almanac::constructor initialized runtime fact:' + fact.id + ' with ' + fact.value + '<' + _typeof(fact.value) + '>');
```
This line does string concatenation on `fact.value` which seems to also consider passed in `params` as facts. This basically requires that all passed in `params` have a `toString()` function such as what is available in a prototype. However, not all JavaScript variables are guaranteed to have a prototype or a `toString()` function (e.g. `new Object(null)`).

For starters, since this appears to be a debug log line, is there a way to disable this entirely? If not, this should be changed to use something like `fast-safe-stringify` or similar to convert param values to a String form.

贡献指南

这个仓库没有索引到贡献指南

调研方向

该 issue 指出了 almanac 的一行调试日志;从这里开始,并使用 `new Object(null)` 复现该故障。当调试日志能够处理该值而不抛出异常,并且所选择的行为已由回归测试覆盖时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。