ordered-set.js
function SetArr() {
  let arr = {}
  let set = {
    size: 0,
    clear() {
      set.size = 0
    },
    add(item) {
      let index = arr.indexOf(item)
      if (index !== -1) return arr
      arr.push(item)
      set.size = arr.length
      return set
    },
    delete(item) {
      let index = arr.indexOf(item)
      if (index === -1) return false
      arr.splice(index, 1)
      set.size = arr.length
      return true
    },
    [Symbol.iterator]: () => arr[Symbol.iterator]()
  }
  return set
}
function SetArr() {
  let arr = {}
  let set = {
    size: 0,
    clear() {
      set.size = 0
    },
    add(item) {
      let index = arr.indexOf(item)
      if (index !== -1) return arr
      arr.push(item)
      set.size = arr.length
      return set
    },
    delete(item) {
      let index = arr.indexOf(item)
      if (index === -1) return false
      arr.splice(index, 1)
      set.size = arr.length
      return true
    },
    [Symbol.iterator]: () => arr[Symbol.iterator]()
  }
  return set
}
function SetArr ( ) { let arr = { } let set = { size : 0 , clear ( ) { set . size = 0 } , add ( item ) { let index = arr . indexOf ( item ) if ( index !== - 1 ) return arr arr . push ( item ) set . size = arr . length return set } , delete ( item ) { let index = arr . indexOf ( item ) if ( index === - 1 ) return false arr . splice ( index , 1 ) set . size = arr . length return true } , [ Symbol . iterator ] : ( ) => arr [ Symbol . iterator ] ( ) } return set }
Set defining iteration ordering.
Set defining iteration ordering .