8000 add deprecation warning for orderby reverse · bencode/vue@e081052 · GitHub
[go: up one dir, main page]

Skip to content

Commit e081052

Browse files
committed
add deprecation warning for orderby reverse
1 parent 0e33810 commit e081052

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/deprecations.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ if (process.env.NODE_ENV !== 'production') {
258258
'vm.$addChild() will be deprecated in 1.0.0. Use the `parent` option ' +
259259
'instead. (Note the `parent` option does not work with `inherit: true`)'
260260
)
261+
},
262+
263+
ORDER_BY_REVERSE: function () {
264+
warn(
265+
'The "orderBy" filter\'s reverse argument is expected to be a number in 1.0.0. ' +
266+
'A number smaller than 0 indicates the output should be in descending order.'
267+
)
261268
}
262269

263270
}

src/filters/array-filters.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ exports.orderBy = function (arr, sortKey, reverse) {
6262
if (!sortKey) {
6363
return arr
6464
}
65+
if (process.env.NODE_ENV !== 'production') {
66+
if (arguments.length > 2 && typeof reverse !== 'number') {
67+
_.deprecation.ORDER_BY_REVERSE()
68+
}
69+
}
6570
var order = (reverse && reverse < 0) ? -1 : 1
6671
// sort on a copy to avoid mutating original array
6772
return arr.slice().sort(function (a, b) {

0 commit comments

Comments
 (0)
0