DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
      • types
        • Set
        • Compares
        • Prop
      • properties
        • Algebra
        • Translate
        • props
          • boolean
          • enum
          • id
          • offsetLimit
          • rangeInclusive
          • sort
    • can-stache
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-set
  • /
  • props
  • /
  • id
  • / On this page
    • id

      function

      Defines the identify property.

      • source

      set.props.id(prop)

      Defines the property name on items that uniquely identifies them. This is the default sorted property if no sort is provided.

      var algebra = new set.Algebra(set.props.id("_id"));
      algebra.index(
        {sortBy: "name desc"},
        [{name: "Meyer"}],
        {name: "Adams"}) //-> 1
      
      algebra.index(
        {sortBy: "name"},
        [{name: "Meyer"}],
        {name: "Adams"}) //-> 0
      

      Parameters

      1. prop {String}:

        The property name that defines the unique property id.

      Returns

      {Compares}:

      Returns a compares that can be used to create a set.Algebra.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.