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

helper: 'order' object syntax won't guaranteed order #125

Open
newlix opened this issue Jan 28, 2016 · 4 comments
Open

helper: 'order' object syntax won't guaranteed order #125

newlix opened this issue Jan 28, 2016 · 4 comments

Comments

@newlix
Copy link
Contributor

newlix commented Jan 28, 2016

Properties order in objects are not guaranteed in JavaScript
We can use an Array of Arrays instead of Object.

{
  type:     'select'
, table:    'users'

// current
, order:    { id: 'desc', name: 'asc' }
, order:    ['id desc', 'name asc']
, order:    'id desc'

//change into
,order: [['id', 'desc'], ['name', 'asc']]
,order: ['id', 'desc']
//
}
@newlix newlix changed the title Change helper: 'order' syntax won't guaranteed order helper: 'order' object syntax won't guaranteed order Jan 28, 2016
@jrf0110
Copy link
Member

jrf0110 commented Jan 28, 2016

Agreed. I'll add a deprecation warning for the old object and string syntaxes.

@newlix
Copy link
Contributor Author

newlix commented Jan 29, 2016

I changed my mind. I thought Array of Objects may be clearer.

order: [ { id: 'desc' }, {name: 'asc' } ]
order: { id: 'desc' }
// and we can keep 
order:  { id: 'desc', name: 'asc' }

@LinusU
Copy link
Contributor

LinusU commented Aug 30, 2016

I personally prefer [['id', 'desc'], ['name', 'asc']], that's also the syntax used by the builtin Map and .entries() so it should align closely with the javascript standard

@jrf0110
Copy link
Member

jrf0110 commented Aug 30, 2016

Yeah, @LinusU I agree there. I'll work on getting this implemented soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants