0

当我使用 Dompurify sanitize 时,如何让布尔值保持不变?

var DOMPurify = require('dompurify');
var forDataGenerate = function (data) {
    var formData = new FormData();
    for (var _i = 0, _a = Object.keys(data); _i < _a.length; _i++) {
        var key = _a[_i];
        formData.append(key, DOMPurify.sanitize(data[key]));
    }
    return formData;
};
var santizeData=forDataGenerate ({a:true,b:null})
//result is ({a:null,b:null})
//but I need to keep this type same.

4

0 回答 0