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

Add Data Transform #4136

Closed
9 tasks
pearmini opened this issue Sep 13, 2022 · 1 comment
Closed
9 tasks

Add Data Transform #4136

pearmini opened this issue Sep 13, 2022 · 1 comment
Assignees
Labels

Comments

@pearmini
Copy link
Member

Data Transform

内置的数据转换函数。目前支持以下几种(🔧 需要修改,🚀 新增):

  • fetch 🔧
  • filterBy 🔧
  • sortBy 🔧
  • map 🚀
  • pick
  • rename
  • fold
  • subset
  • custom 🔧

变更点

TODO @pepper-nice

@pepper-nice
Copy link
Contributor

pepper-nice commented Sep 13, 2022

API Design

fetch
{ 
  type: 'fetch',
  value: 'http://xxx.json',
  format: 'csv' | 'json',
  // detect data types such as dates and booleans and convert values to the corresponding JS type.
  autoType?: true | false,
}
filterBy
// Filter field with different callback. 
{ type: 'filterBy', fields: [ ['time', callback], ['count', callback] }
sortBy
// true => asc; false => desc
{ type: 'sortBy', fields: [ ['time', true], ['count', false] ] }
map
// Handle array data with callback.
{ type: 'map', callback: data => data }
custom
// Handle any type data with callback.
{ type: 'custom', callback: data => data }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants