1.0.4 • Published 6 years ago

merge-sequelize-options v1.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

merge-sequelize-options

Utility for merging n sequelize options objects.

State of this package

Custom merging logic is to be implemented for the different techniques and syntax variations of the various sequelize options.

The default behaviour (when custom logic is not implemented) is to recursively merge source object(s) into target. Array and Plain Object attributes will be merged with those of subsequent sources, other type values will be overwritten.

Check the issues page to see which options need to be implemented

Example Usage

  const target = {
    limit: 25,
    offset: 0,
    order: [
      ['name', 'desc'],
      ['type', 'desc']
    ]
  }

  const source = {
    offset: 50,
    order: [
      ['name', 'asc'],
      ['email', 'desc]
    ]
  }

  mergeSequelizeOptions(target, source)
  // custom logic is implemented for basic order clause syntax
  // => 
  {
    limit: 25,
    offset: 50,
    order: [
      ['name', 'asc'],
      ['type', 'desc'],
      ['email', 'desc']
    ]
  }

Contributing

Check out the issues page or create one of your own. Please include tests with any pull requests. To run tests, use

  npm test
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago