Comparable

Ember.Comparable Class

PRIVATE

Defined in: packages/ember-runtime/lib/mixins/comparable.js:8

Module: ember-runtime

Implements some standard methods for comparing objects. Add this mixin to any class you create that can compare its instances.

You should implement the compare() method.

compare (a, b) Numberprivate

Defined in packages/ember-runtime/lib/mixins/comparable.js:21

Required. You must implement this method to apply this mixin.

Override to return the result of the comparison of the two parameters. The compare method should return:

  • -1 if a < b
  • 0 if a == b
  • 1 if a > b

Default implementation raises an exception.

Parameters:

a Object
the first object to compare
b Object
the second object to compare

Returns:

Number
the result of the comparison

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/classes/Ember.Comparable.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部