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

disable sorting of arrays #15

Closed
adrian-gierakowski opened this issue Jun 10, 2019 · 6 comments
Closed

disable sorting of arrays #15

adrian-gierakowski opened this issue Jun 10, 2019 · 6 comments

Comments

@adrian-gierakowski
Copy link

I'd like to be able to disable the sorting of arrays, so that hash([1,2] != hash([2,1]), while keeping all other "object" types sorted. Is this currently possible?

@SkeLLLa
Copy link
Owner

SkeLLLa commented Jun 10, 2019

Hi. Currently it's not supported. But I think it's easy to add such option.
For example object sorter could consume not only boolean, but also an object that will define granular sorting behaviour for needed types that are used in stringifier.* methods.

It would be non-breaking change, and quiet easy to implement. If you would like to submit a PR, you're welcome. If not, I think I could find some time by the next weekend to add this.

@adrian-gierakowski
Copy link
Author

thanks, I've added a sortArrays option on my fork for now, which I set to false to get my desired behaviour, cause that was the quickest way to get what I wanted. But I'll try to submit a PR with your what you've suggested if I find some time later this week.

@SkeLLLa
Copy link
Owner

SkeLLLa commented Jun 10, 2019

@adrian-gierakowski good.

@SkeLLLa
Copy link
Owner

SkeLLLa commented Sep 1, 2019

If you still interested I've implemented granular sorting control options. The changes aren't published yet, but you may preview them in https://github.com/SkeLLLa/node-object-hash/tree/next branch.

Now it will add possibility to control what kind of items you need to sort. Also it allows to disable type coercion(https://github.com/SkeLLLa/node-object-hash/blob/next/docs/interfaces/objectsorter.coerceoptions.md).

I think it will be released in near future (~ in a week I think). But that would be v2.0.0.

@SkeLLLa
Copy link
Owner

SkeLLLa commented Sep 3, 2019

@SkeLLLa
Copy link
Owner

SkeLLLa commented Sep 7, 2019

Released in v2.0.0. Feel free to test and reopen if it doesn't work as expected.

@SkeLLLa SkeLLLa closed this as completed Sep 7, 2019
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