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
Open

Add a custom helper for sorting array #1270

louiskhchan opened this issue Jan 17, 2024 · 2 comments
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.

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

No branches or pull requests

3 participants