mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 00:47:46 -06:00
REFACTOR: Use Array.isArray
instead of _.isArray
This commit is contained in:
parent
b129abfc11
commit
2f11457263
@ -5,6 +5,8 @@
|
||||
"discourse-ember/global-ember": 2
|
||||
},
|
||||
"globals": {
|
||||
"bootbox": "off"
|
||||
"bootbox": "off",
|
||||
"Mousetrap": "off",
|
||||
"_": "off"
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ Report.reopenClass({
|
||||
const startDate = options.startDate || "start_date";
|
||||
const endDate = options.endDate || "end_date";
|
||||
|
||||
if (_.isArray(report[dataField])) {
|
||||
if (Array.isArray(report[dataField])) {
|
||||
const startDateFormatted = moment
|
||||
.utc(report[startDate])
|
||||
.locale("en")
|
||||
|
@ -27,7 +27,7 @@ export default Component.extend({
|
||||
$(this.element.querySelector("input")).autocomplete({
|
||||
debounced: true,
|
||||
allowAny: false,
|
||||
items: _.isArray(groupNames)
|
||||
items: Array.isArray(groupNames)
|
||||
? groupNames
|
||||
: isEmpty(groupNames)
|
||||
? []
|
||||
|
@ -275,7 +275,7 @@ export default Component.extend({
|
||||
const group = this.get("searchedTerms.group");
|
||||
|
||||
if (match.length !== 0) {
|
||||
const existingInput = _.isArray(group) ? group[0] : group;
|
||||
const existingInput = Array.isArray(group) ? group[0] : group;
|
||||
const userInput = match[0].replace(REGEXP_GROUP_PREFIX, "");
|
||||
|
||||
if (existingInput !== userInput) {
|
||||
@ -294,7 +294,7 @@ export default Component.extend({
|
||||
const badge = this.get("searchedTerms.badge");
|
||||
|
||||
if (match.length !== 0) {
|
||||
const existingInput = _.isArray(badge) ? badge[0] : badge;
|
||||
const existingInput = Array.isArray(badge) ? badge[0] : badge;
|
||||
const userInput = match[0].replace(REGEXP_BADGE_PREFIX, "");
|
||||
|
||||
if (existingInput !== userInput) {
|
||||
@ -317,7 +317,7 @@ export default Component.extend({
|
||||
|
||||
if (match.length !== 0) {
|
||||
const join_char = contain_all_tags ? "+" : ",";
|
||||
const existingInput = _.isArray(tags) ? tags.join(join_char) : tags;
|
||||
const existingInput = Array.isArray(tags) ? tags.join(join_char) : tags;
|
||||
const userInput = match[0].replace(REGEXP_TAGS_REPLACE, "");
|
||||
|
||||
if (existingInput !== userInput) {
|
||||
|
@ -113,7 +113,7 @@ export default function(options) {
|
||||
if (options.single) {
|
||||
inputSelectedItems = [];
|
||||
}
|
||||
transformed = _.isArray(transformedItem)
|
||||
transformed = Array.isArray(transformedItem)
|
||||
? transformedItem
|
||||
: [transformedItem || item];
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { htmlSafe as htmlSafeTemplateHelper } from "@ember/template";
|
||||
function addonFmt(str, formats) {
|
||||
let cachedFormats = formats;
|
||||
|
||||
if (!_.isArray(cachedFormats) || arguments.length > 2) {
|
||||
if (!Array.isArray(cachedFormats) || arguments.length > 2) {
|
||||
cachedFormats = new Array(arguments.length - 1);
|
||||
|
||||
for (let i = 1, l = arguments.length; i < l; i++) {
|
||||
|
@ -13,7 +13,7 @@ QUnit.module("lib:keyboard-shortcuts", {
|
||||
_bindings[binding] = callback;
|
||||
}.bind(this);
|
||||
|
||||
if (_.isArray(bindings)) {
|
||||
if (Array.isArray(bindings)) {
|
||||
bindings.forEach(registerBinding, this);
|
||||
} else {
|
||||
registerBinding(bindings);
|
||||
|
Loading…
Reference in New Issue
Block a user