1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
stringify.js 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-23 09:59 +08:00 . Vue6
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const quote_1 = require("./quote");
const object_1 = require("./object");
const function_1 = require("./function");
/**
* Stringify primitive values.
*/
const PRIMITIVE_TYPES = {
string: quote_1.quoteString,
number: (value) => (Object.is(value, -0) ? "-0" : String(value)),
boolean: String,
symbol: (value, space, next) => {
const key = Symbol.keyFor(value);
if (key !== undefined)
return `Symbol.for(${next(key)})`;
// ES2018 `Symbol.description`.
return `Symbol(${next(value.description)})`;
},
bigint: (value, space, next) => {
return `BigInt(${next(String(value))})`;
},
undefined: String,
object: object_1.objectToString,
function: function_1.functionToString
};
/**
* Stringify a value recursively.
*/
exports.toString = (value, space, next, key) => {
if (value === null)
return "null";
return PRIMITIVE_TYPES[typeof value](value, space, next, key);
};
//# sourceMappingURL=stringify.js.map
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助