API Docs for: v2.11.0-beta.7
Show:

Ember.Comparable Class

Module: ember-runtime
Parent Module: ember

Available since Ember 0.9

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.

Item Index

Methods

Methods

compare

(
  • a
  • b
)
Number private

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