Use Object.keys instead of _.keys
This commit is contained in:
parent
34469425d6
commit
ba6de8844e
36
dist/converse.js
vendored
36
dist/converse.js
vendored
@ -55031,7 +55031,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
|
||||
|
||||
const codes = _.invokeMap(statuses, Element.prototype.getAttribute, 'code');
|
||||
|
||||
const disconnection_codes = _.intersection(codes, _.keys(_converse.muc.disconnect_messages));
|
||||
const disconnection_codes = _.intersection(codes, Object.keys(_converse.muc.disconnect_messages));
|
||||
|
||||
const disconnected = is_self && disconnection_codes.length > 0;
|
||||
|
||||
@ -57132,7 +57132,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
||||
},
|
||||
|
||||
removeAllSessions(identifier) {
|
||||
const keys = _.filter(_.keys(this.attributes), key => {
|
||||
const keys = _.filter(Object.keys(this.attributes), key => {
|
||||
if (key.startsWith('session' + identifier)) {
|
||||
return key;
|
||||
}
|
||||
@ -57169,7 +57169,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
||||
|
||||
async generateMissingPreKeys() {
|
||||
const current_keys = this.getPreKeys(),
|
||||
missing_keys = _.difference(_.invokeMap(_.range(0, _converse.NUM_PREKEYS), Number.prototype.toString), _.keys(current_keys));
|
||||
missing_keys = _.difference(_.invokeMap(_.range(0, _converse.NUM_PREKEYS), Number.prototype.toString), Object.keys(current_keys));
|
||||
|
||||
if (missing_keys.length < 1) {
|
||||
_converse.log("No missing prekeys to generate for our own device", Strophe.LogLevel.WARN);
|
||||
@ -58309,12 +58309,7 @@ const _converse$env = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_
|
||||
|
||||
Strophe.addNamespace('REGISTER', 'jabber:iq:register'); // Add Strophe Statuses
|
||||
|
||||
let i = 0;
|
||||
|
||||
_.each(_.keys(Strophe.Status), function (key) {
|
||||
i = Math.max(i, Strophe.Status[key]);
|
||||
});
|
||||
|
||||
const i = Object.keys(Strophe.Status).reduce((max, k) => Math.max(max, Strophe.Status[k]), 0);
|
||||
Strophe.Status.REGIFAIL = i + 1;
|
||||
Strophe.Status.REGISTERED = i + 2;
|
||||
Strophe.Status.CONFLICT = i + 3;
|
||||
@ -58602,7 +58597,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
|
||||
Object.assign(this, defaults);
|
||||
|
||||
if (settings) {
|
||||
Object.assign(this, _.pick(settings, _.keys(defaults)));
|
||||
Object.assign(this, _.pick(settings, Object.keys(defaults)));
|
||||
}
|
||||
},
|
||||
|
||||
@ -58749,7 +58744,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
|
||||
},
|
||||
|
||||
renderLegacyRegistrationForm(form) {
|
||||
_.each(_.keys(this.fields), key => {
|
||||
_.each(Object.keys(this.fields), key => {
|
||||
if (key === "username") {
|
||||
form.insertAdjacentHTML('beforeend', templates_form_username_html__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||
'domain': ` @${this.domain}`,
|
||||
@ -59508,8 +59503,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
|
||||
*/
|
||||
a = a.get('name');
|
||||
b = b.get('name');
|
||||
|
||||
const special_groups = _.keys(HEADER_WEIGHTS);
|
||||
const special_groups = Object.keys(HEADER_WEIGHTS);
|
||||
|
||||
const a_is_special = _.includes(special_groups, a);
|
||||
|
||||
@ -59866,7 +59860,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
|
||||
show = this.model.presence.get('show'),
|
||||
requesting = this.model.get('requesting'),
|
||||
subscription = this.model.get('subscription');
|
||||
const classes_to_remove = ['current-xmpp-contact', 'pending-xmpp-contact', 'requesting-xmpp-contact'].concat(_.keys(STATUSES));
|
||||
const classes_to_remove = ['current-xmpp-contact', 'pending-xmpp-contact', 'requesting-xmpp-contact'].concat(Object.keys(STATUSES));
|
||||
|
||||
_.each(classes_to_remove, function (cls) {
|
||||
if (_.includes(that.el.className, cls)) {
|
||||
@ -64006,7 +64000,7 @@ _converse.initialize = async function (settings, callback) {
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this, this.default_settings); // Allow only whitelisted configuration attributes to be overwritten
|
||||
|
||||
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(settings, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(this.default_settings)));
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(settings, Object.keys(this.default_settings)));
|
||||
|
||||
if (this.authentication === _converse.ANONYMOUS) {
|
||||
if (this.auto_login && !this.jid) {
|
||||
@ -64417,7 +64411,7 @@ _converse.initialize = async function (settings, callback) {
|
||||
} // Recreate all the promises
|
||||
|
||||
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.each(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.promises), addPromise);
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.each(Object.keys(_converse.promises), addPromise);
|
||||
/**
|
||||
* Triggered once the user has logged out.
|
||||
* @event _converse#logout
|
||||
@ -65057,7 +65051,7 @@ _converse.api = {
|
||||
'status': value
|
||||
};
|
||||
|
||||
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.STATUS_WEIGHTS), value)) {
|
||||
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(Object.keys(_converse.STATUS_WEIGHTS), value)) {
|
||||
throw new Error('Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1');
|
||||
}
|
||||
|
||||
@ -65139,7 +65133,7 @@ _converse.api = {
|
||||
* @example _converse.api.settings.get("play_sounds");
|
||||
*/
|
||||
'get'(key) {
|
||||
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.default_settings), key)) {
|
||||
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(Object.keys(_converse.default_settings), key)) {
|
||||
return _converse[key];
|
||||
}
|
||||
},
|
||||
@ -65166,11 +65160,11 @@ _converse.api = {
|
||||
const o = {};
|
||||
|
||||
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isObject(key)) {
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(key, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.default_settings)));
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(key, Object.keys(_converse.default_settings)));
|
||||
} else if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isString("string")) {
|
||||
o[key] = val;
|
||||
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(o, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.default_settings)));
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(o, Object.keys(_converse.default_settings)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -66410,7 +66404,7 @@ function queryForArchivedMessages(_converse, options, callback, errback) {
|
||||
|
||||
if (options instanceof Strophe.RSM) {
|
||||
stanza.cnode(options.toXML());
|
||||
} else if (_.intersection(RSM_ATTRIBUTES, _.keys(options)).length) {
|
||||
} else if (_.intersection(RSM_ATTRIBUTES, Object.keys(options)).length) {
|
||||
stanza.cnode(new Strophe.RSM(options).toXML());
|
||||
}
|
||||
}
|
||||
|
@ -1482,7 +1482,7 @@ converse.plugins.add('converse-muc-views', {
|
||||
}
|
||||
// 2. Get disconnection messages based on the <status> elements
|
||||
const codes = _.invokeMap(statuses, Element.prototype.getAttribute, 'code');
|
||||
const disconnection_codes = _.intersection(codes, _.keys(_converse.muc.disconnect_messages));
|
||||
const disconnection_codes = _.intersection(codes, Object.keys(_converse.muc.disconnect_messages));
|
||||
const disconnected = is_self && disconnection_codes.length > 0;
|
||||
if (disconnected) {
|
||||
notification.disconnected = true;
|
||||
|
@ -790,7 +790,7 @@ converse.plugins.add('converse-omemo', {
|
||||
},
|
||||
|
||||
removeAllSessions (identifier) {
|
||||
const keys = _.filter(_.keys(this.attributes), (key) => {
|
||||
const keys = _.filter(Object.keys(this.attributes), (key) => {
|
||||
if (key.startsWith('session'+identifier)) {
|
||||
return key;
|
||||
}
|
||||
@ -821,7 +821,7 @@ converse.plugins.add('converse-omemo', {
|
||||
|
||||
async generateMissingPreKeys () {
|
||||
const current_keys = this.getPreKeys(),
|
||||
missing_keys = _.difference(_.invokeMap(_.range(0, _converse.NUM_PREKEYS), Number.prototype.toString), _.keys(current_keys));
|
||||
missing_keys = _.difference(_.invokeMap(_.range(0, _converse.NUM_PREKEYS), Number.prototype.toString), Object.keys(current_keys));
|
||||
|
||||
if (missing_keys.length < 1) {
|
||||
_converse.log("No missing prekeys to generate for our own device", Strophe.LogLevel.WARN);
|
||||
|
@ -28,10 +28,7 @@ const { Strophe, Backbone, sizzle, $iq, _ } = converse.env;
|
||||
Strophe.addNamespace('REGISTER', 'jabber:iq:register');
|
||||
|
||||
// Add Strophe Statuses
|
||||
let i = 0;
|
||||
_.each(_.keys(Strophe.Status), function (key) {
|
||||
i = Math.max(i, Strophe.Status[key]);
|
||||
});
|
||||
const i = Object.keys(Strophe.Status).reduce((max, k) => Math.max(max, Strophe.Status[k]), 0);
|
||||
Strophe.Status.REGIFAIL = i + 1;
|
||||
Strophe.Status.REGISTERED = i + 2;
|
||||
Strophe.Status.CONFLICT = i + 3;
|
||||
@ -296,7 +293,7 @@ converse.plugins.add('converse-register', {
|
||||
};
|
||||
Object.assign(this, defaults);
|
||||
if (settings) {
|
||||
Object.assign(this, _.pick(settings, _.keys(defaults)));
|
||||
Object.assign(this, _.pick(settings, Object.keys(defaults)));
|
||||
}
|
||||
},
|
||||
|
||||
@ -441,7 +438,7 @@ converse.plugins.add('converse-register', {
|
||||
},
|
||||
|
||||
renderLegacyRegistrationForm (form) {
|
||||
_.each(_.keys(this.fields), (key) => {
|
||||
_.each(Object.keys(this.fields), (key) => {
|
||||
if (key === "username") {
|
||||
form.insertAdjacentHTML(
|
||||
'beforeend',
|
||||
|
@ -92,7 +92,7 @@ converse.plugins.add('converse-rosterview', {
|
||||
*/
|
||||
a = a.get('name');
|
||||
b = b.get('name');
|
||||
const special_groups = _.keys(HEADER_WEIGHTS);
|
||||
const special_groups = Object.keys(HEADER_WEIGHTS);
|
||||
const a_is_special = _.includes(special_groups, a);
|
||||
const b_is_special = _.includes(special_groups, b);
|
||||
if (!a_is_special && !b_is_special ) {
|
||||
@ -416,7 +416,7 @@ converse.plugins.add('converse-rosterview', {
|
||||
'current-xmpp-contact',
|
||||
'pending-xmpp-contact',
|
||||
'requesting-xmpp-contact'
|
||||
].concat(_.keys(STATUSES));
|
||||
].concat(Object.keys(STATUSES));
|
||||
|
||||
_.each(classes_to_remove,
|
||||
function (cls) {
|
||||
|
@ -551,7 +551,7 @@ _converse.initialize = async function (settings, callback) {
|
||||
|
||||
_.assignIn(this, this.default_settings);
|
||||
// Allow only whitelisted configuration attributes to be overwritten
|
||||
_.assignIn(this, _.pick(settings, _.keys(this.default_settings)));
|
||||
_.assignIn(this, _.pick(settings, Object.keys(this.default_settings)));
|
||||
|
||||
if (this.authentication === _converse.ANONYMOUS) {
|
||||
if (this.auto_login && !this.jid) {
|
||||
@ -906,7 +906,7 @@ _converse.initialize = async function (settings, callback) {
|
||||
_converse.tearDown();
|
||||
}
|
||||
// Recreate all the promises
|
||||
_.each(_.keys(_converse.promises), addPromise);
|
||||
_.each(Object.keys(_converse.promises), addPromise);
|
||||
/**
|
||||
* Triggered once the user has logged out.
|
||||
* @event _converse#logout
|
||||
@ -1494,7 +1494,7 @@ _converse.api = {
|
||||
*/
|
||||
'set' (value, message) {
|
||||
const data = {'status': value};
|
||||
if (!_.includes(_.keys(_converse.STATUS_WEIGHTS), value)) {
|
||||
if (!_.includes(Object.keys(_converse.STATUS_WEIGHTS), value)) {
|
||||
throw new Error('Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1');
|
||||
}
|
||||
if (_.isString(message)) {
|
||||
@ -1568,7 +1568,7 @@ _converse.api = {
|
||||
* @example _converse.api.settings.get("play_sounds");
|
||||
*/
|
||||
'get' (key) {
|
||||
if (_.includes(_.keys(_converse.default_settings), key)) {
|
||||
if (_.includes(Object.keys(_converse.default_settings), key)) {
|
||||
return _converse[key];
|
||||
}
|
||||
},
|
||||
@ -1593,10 +1593,10 @@ _converse.api = {
|
||||
'set' (key, val) {
|
||||
const o = {};
|
||||
if (_.isObject(key)) {
|
||||
_.assignIn(_converse, _.pick(key, _.keys(_converse.default_settings)));
|
||||
_.assignIn(_converse, _.pick(key, Object.keys(_converse.default_settings)));
|
||||
} else if (_.isString("string")) {
|
||||
o[key] = val;
|
||||
_.assignIn(_converse, _.pick(o, _.keys(_converse.default_settings)));
|
||||
_.assignIn(_converse, _.pick(o, Object.keys(_converse.default_settings)));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -64,7 +64,7 @@ function queryForArchivedMessages (_converse, options, callback, errback) {
|
||||
stanza.up();
|
||||
if (options instanceof Strophe.RSM) {
|
||||
stanza.cnode(options.toXML());
|
||||
} else if (_.intersection(RSM_ATTRIBUTES, _.keys(options)).length) {
|
||||
} else if (_.intersection(RSM_ATTRIBUTES, Object.keys(options)).length) {
|
||||
stanza.cnode(new Strophe.RSM(options).toXML());
|
||||
}
|
||||
}
|
||||
|
14
src/headless/dist/converse-headless.js
vendored
14
src/headless/dist/converse-headless.js
vendored
@ -42237,7 +42237,7 @@ _converse.initialize = async function (settings, callback) {
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this, this.default_settings); // Allow only whitelisted configuration attributes to be overwritten
|
||||
|
||||
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(settings, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(this.default_settings)));
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(settings, Object.keys(this.default_settings)));
|
||||
|
||||
if (this.authentication === _converse.ANONYMOUS) {
|
||||
if (this.auto_login && !this.jid) {
|
||||
@ -42648,7 +42648,7 @@ _converse.initialize = async function (settings, callback) {
|
||||
} // Recreate all the promises
|
||||
|
||||
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.each(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.promises), addPromise);
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.each(Object.keys(_converse.promises), addPromise);
|
||||
/**
|
||||
* Triggered once the user has logged out.
|
||||
* @event _converse#logout
|
||||
@ -43288,7 +43288,7 @@ _converse.api = {
|
||||
'status': value
|
||||
};
|
||||
|
||||
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.STATUS_WEIGHTS), value)) {
|
||||
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(Object.keys(_converse.STATUS_WEIGHTS), value)) {
|
||||
throw new Error('Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1');
|
||||
}
|
||||
|
||||
@ -43370,7 +43370,7 @@ _converse.api = {
|
||||
* @example _converse.api.settings.get("play_sounds");
|
||||
*/
|
||||
'get'(key) {
|
||||
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.default_settings), key)) {
|
||||
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.includes(Object.keys(_converse.default_settings), key)) {
|
||||
return _converse[key];
|
||||
}
|
||||
},
|
||||
@ -43397,11 +43397,11 @@ _converse.api = {
|
||||
const o = {};
|
||||
|
||||
if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isObject(key)) {
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(key, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.default_settings)));
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(key, Object.keys(_converse.default_settings)));
|
||||
} else if (_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isString("string")) {
|
||||
o[key] = val;
|
||||
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(o, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.keys(_converse.default_settings)));
|
||||
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.pick(o, Object.keys(_converse.default_settings)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -44641,7 +44641,7 @@ function queryForArchivedMessages(_converse, options, callback, errback) {
|
||||
|
||||
if (options instanceof Strophe.RSM) {
|
||||
stanza.cnode(options.toXML());
|
||||
} else if (_.intersection(RSM_ATTRIBUTES, _.keys(options)).length) {
|
||||
} else if (_.intersection(RSM_ATTRIBUTES, Object.keys(options)).length) {
|
||||
stanza.cnode(new Strophe.RSM(options).toXML());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user