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 a custom helper for sorting array #1270

Open
louiskhchan opened this issue Jan 17, 2024 · 2 comments · May be fixed by #1415
Open

Add a custom helper for sorting array #1270

louiskhchan opened this issue Jan 17, 2024 · 2 comments · May be fixed by #1415
Assignees
Labels
feature New feature request

Comments

@louiskhchan
Copy link

Currently, Mockoon has array helpers like filter and slice. It would be ideal if a sort helper could be added.

Discussion: #1257

@255kb 255kb added the feature New feature request label Jan 17, 2024
@ajatkj
Copy link
Contributor

ajatkj commented Mar 29, 2024

@255kb Please assign this to me.

@255kb
Copy link
Member

255kb commented Mar 29, 2024

We discussed a bit with @ajatkj and propose the following implementation with two helpers:

  • {{sort 'asc|desc'}} for arrays of strings and numbers.
  • {{sortBy 'keyname' 'asc|desc'}} for arrays of objects.

@ajatkj ajatkj linked a pull request Jun 12, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

3 participants