8000 cast values to numbers in limitBy (fix #2105) · vuejs/vue@bedab9d · GitHub
[go: up one dir, main page]

Skip to content

Commit bedab9d

Browse files
committed
cast values to numbers in limitBy (fix #2105)
1 parent 5d2c76f commit bedab9d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/filters/array-filters.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { getPath } from '../parsers/path'
2-
import { toArray, isArray, isObject, isPlainObject } from '../util/index'
32
import vFor from '../directives/public/for'
3+
import {
4+
toArray,
5+
toNumber,
6+
isArray,
7+
isObject,
8+
isPlainObject
9+
} from '../util/index'
410
const convertArray = vFor._postProcess
511

612
/**
@@ -12,6 +18,7 @@ const convertArray = vFor._postProcess
1218

1319
export function limitBy (arr, n, offset) {
1420
offset = offset ? parseInt(offset, 10) : 0
21+
n = toNumber(n)
1522
return typeof n === 'number'
1623
? arr.slice(offset, offset + n)
1724
: arr

0 commit comments

Comments
 (0)
0