Skip to content

Commit

Permalink
small cleanup mixins/array
Browse files Browse the repository at this point in the history
  • Loading branch information
bekzod committed Jun 5, 2018
1 parent 6f1b060 commit 8ad2772
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions packages/ember-runtime/lib/mixins/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import { ARRAY_AT_EACH } from '@ember/deprecated-features';
import { DEBUG } from '@glimmer/env';
import { HAS_NATIVE_PROXY } from 'ember-utils';
import { PROXY_CONTENT } from 'ember-metal';
import { symbol, toString } from 'ember-utils';
import { symbol, toString, HAS_NATIVE_PROXY } from 'ember-utils';
import {
get,
set,
Expand Down Expand Up @@ -146,10 +145,7 @@ export function isArray(_obj) {
if (!obj || obj.setInterval) {
return false;
}
if (Array.isArray(obj)) {
return true;
}
if (ArrayMixin.detect(obj)) {
if (Array.isArray(obj) || ArrayMixin.detect(obj)) {
return true;
}

Expand Down Expand Up @@ -1172,17 +1168,12 @@ const ArrayMixin = Mixin.create(Enumerable, {

const OUT_OF_RANGE_EXCEPTION = 'Index out of range';

export function removeAt(array, start, len) {
export function removeAt(array, start, len = 1) {
if ('number' === typeof start) {
if (start < 0 || start >= array.length) {
throw new EmberError(OUT_OF_RANGE_EXCEPTION);
}

// fast case
if (len === undefined) {
len = 1;
}

array.replace(start, len, EMPTY_ARRAY);
}

Expand Down

0 comments on commit 8ad2772

Please sign in to comment.