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

Adds (sort) 'options' feature and new tests/docs #3

Merged
merged 4 commits into from Feb 26, 2017

Conversation

matteocng
Copy link
Contributor

@matteocng matteocng commented Feb 25, 2017

The following commits improve the existing code, docs and tests:

  • test/docs: add test and docs for the custom sort function parameter
  • test: add non-array/non-object test

This one adds the new feature:

  • feat: add 'options' support with a new third, optional parameter

See: #2

Adds the following:
- A third, optional 'opts' parameter (object) to the sort() function exported by this module.
- Code, tests and docs for the 'ignoreObjectAtKeys' and 'ignoreArrayAtKeys' options.
- Fix: passes 'compare' (custom sort function, the second optional parameter) to 'sortArray' in './index.js'.
@Kikobeats
Copy link
Owner

Comments ahead. Thanks for that!

Question: Are ignoreArrayAtKeys ignoreObjectAtKeys actually necessary? is not enough using compare method for exclude things that you want?

@matteocng
Copy link
Contributor Author

matteocng commented Feb 26, 2017

@Kikobeats the custom compare function (modified to pass the current 'key' as the third parameter, so that you'd have more control) could get the job done if one was using finepack's API (unless we added support for .js configuration files to bumped - like eslint, postcss - so that not just static values, but functions too could be passed to plugins). When using finepack via bumped-finepack (and a JSON/CSON/YAML .bumpedrc) instead, those parameters (with the related PR that I can contribute to finepack) can let one do something very convenient:

plugins:
  postrelease:
    'Lint config files':
      plugin: 'bumped-finepack'
      opts:
        sortOptions:
          ignoreObjectAtKeys: [
            'rules' 
          ]    

This way users who need the ignore feature don't have to use the API, they just need to add a few lines to their .bumpedrc file.

@Kikobeats
Copy link
Owner

ok, it has sense, but use compare as options property for avoid pass null 👍

@Kikobeats Kikobeats merged commit c448cf4 into Kikobeats:master Feb 26, 2017
@matteocng matteocng deleted the feat-sort-options branch February 26, 2017 21:39
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

Successfully merging this pull request may close these issues.

None yet

2 participants