gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

Possibility to use flexible sorting #422

Closed yasaricli closed 5 years ago

yasaricli commented 5 years ago

the sorting can be made possible in all languages.

https://github.com/gcanti/tcomb-form/blob/master/src/components.js#L55

function sortByText(a, b) {
  if (a.text < b.text) {
    return -1
  } else if (a.text > b.text) {
    return 1
  }
  return 0
}

sortByText({text: 'z'}, {text: 'İ'}) // -1

// Use localeCompare
'z'.localeCompare('İ') // 1

thanks.

yasaricli commented 5 years ago

Ping @gcanti

gcanti commented 5 years ago

Thanks @yasaricli

yasaricli commented 5 years ago

you're welcome @gcanti