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

feat: update some data transform #4140

Merged
merged 2 commits into from
Sep 19, 2022
Merged

feat: update some data transform #4140

merged 2 commits into from
Sep 19, 2022

Conversation

pepper-nice
Copy link
Contributor

Related Issue

#4136

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 }

Implement

  • code
  • test
  • docs

src/data/sortBy.ts Outdated Show resolved Hide resolved
src/data/sortBy.ts Outdated Show resolved Hide resolved
__tests__/unit/data/fetch.spec.ts Outdated Show resolved Hide resolved
__tests__/unit/data/sortBy.spec.ts Show resolved Hide resolved
docs/data.md Show resolved Hide resolved
docs/data.md Outdated Show resolved Hide resolved
@pearmini pearmini changed the title feat: update data transfrom sortBy&filterBy&custom&map&fetch feat: update some data transform Sep 14, 2022
docs/data-fetch.md Outdated Show resolved Hide resolved
docs/data-fetch.md Outdated Show resolved Hide resolved
docs/data-fetch.md Outdated Show resolved Hide resolved
docs/data-fetch.md Outdated Show resolved Hide resolved
docs/data-fetch.md Outdated Show resolved Hide resolved
docs/data-fetch.md Outdated Show resolved Hide resolved
src/data/filterBy.ts Outdated Show resolved Hide resolved
src/data/utils/fields.ts Outdated Show resolved Hide resolved
src/data/utils/fields.ts Outdated Show resolved Hide resolved
docs/data-fetch.md Outdated Show resolved Hide resolved
src/data/custom.ts Outdated Show resolved Hide resolved
Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 PR 里把 coordinate 的文档去掉,coordinate 的文档可以作为下一个 PR。

@pearmini pearmini merged commit f7524c1 into v5 Sep 19, 2022
@pearmini pearmini deleted the feat/data-transform branch September 19, 2022 06:22
hustcc pushed a commit that referenced this pull request May 16, 2023
* feat: update data transfrom sortBy&filterBy&custom&map&fetch

* docs: add data docs.
hustcc pushed a commit that referenced this pull request May 16, 2023
* feat: update data transfrom sortBy&filterBy&custom&map&fetch

* docs: add data docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants