Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions asx/src/asx/array/min.as
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package asx.array
{
for each (item in iterable)
{
if (!result)
if (!result && !(result is Number))
{
result = item;
}
Expand All @@ -39,4 +39,4 @@ package asx.array

return result;
}
}
}
6 changes: 3 additions & 3 deletions asx_test/src/asx/array/MinTest.as
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package asx.array
[Test]
public function min_withArray_returnsTheMinimumItem():void
{
assertThat(min([1, 101, 11, 10, 100]), equalTo(1));
assertThat(min(['1', '101', '11', '10', '100']), equalTo('1'));
assertThat(min([1, 101, 11, 10, 0, 100]), equalTo(0));
assertThat(min(['1', '101', '11', '10', '0', '100']), equalTo('0'));
}

[Test]
Expand All @@ -24,4 +24,4 @@ package asx.array
assertThat(min(items, 'value'), hasProperty('value', 1));
}
}
}
}