Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser 功能目前有哪些情况不支持的或待处理的吗? #1

Closed
wll8 opened this issue Dec 16, 2021 · 1 comment
Closed

Comments

@wll8
Copy link

wll8 commented Dec 16, 2021

  • 文档上说支持 函数、正则,那对于其他类型呢?例如 Date 啥啥的。
  • 另外,如果类似 xfunc 的前缀已被要序列号的数据使用了呢?但由于数据的不可知性,是无法知道哪个前缀会被占用的。
  • 继上面问题之后:如果要实现 获取代码中的片段 功能是否可靠?
const obj = {
  a: 1,
  b() {
    // 这是一些注释
    console.log(123)
  },
}

// 如果获取 obj 的原始代码?
const code = getCode(obj)
// 输出以下字符串

code ===

 {
  a: 1,
  b() {
    // 这是一些注释
    console.log(123)
  },
}
@MrXujiang
Copy link
Owner

  • 文档上说支持 函数、正则,那对于其他类型呢?例如 Date 啥啥的。
  • 另外,如果类似 xfunc 的前缀已被要序列号的数据使用了呢?但由于数据的不可知性,是无法知道哪个前缀会被占用的。
  • 继上面问题之后:如果要实现 获取代码中的片段 功能是否可靠?
const obj = {
  a: 1,
  b() {
    // 这是一些注释
    console.log(123)
  },
}

// 如果获取 obj 的原始代码?
const code = getCode(obj)
// 输出以下字符串

code ===

 {
  a: 1,
  b() {
    // 这是一些注释
    console.log(123)
  },
}

目前前缀通过__xfunc__, __xreg__来隔离, 后期考虑用更优雅的方式优化,
问题二, 目前基于parse可以实现getCode(obj)的方式, 如果有更好的建议, 随时提pr和issue反馈,持续迭代~

@wll8 wll8 closed this as completed Dec 30, 2021
MrXujiang pushed a commit that referenced this issue Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants