* @return Whether the value was added.
(array, toAdd, equalityComparer)
| 1211 | * @return Whether the value was added. |
| 1212 | */ |
| 1213 | function pushIfUnique(array, toAdd, equalityComparer) { |
| 1214 | if (contains(array, toAdd, equalityComparer)) { |
| 1215 | return false; |
| 1216 | } |
| 1217 | else { |
| 1218 | array.push(toAdd); |
| 1219 | return true; |
| 1220 | } |
| 1221 | } |
| 1222 | ts.pushIfUnique = pushIfUnique; |
| 1223 | /** |
| 1224 | * Unlike `pushIfUnique`, this can take `undefined` as an input, and returns a new array. |
no test coverage detected