mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
refactor: use more appropriate array methods (#39321)
This commit is contained in:
@@ -1184,7 +1184,7 @@ describe('app module', () => {
|
||||
app.setAsDefaultProtocolClient(protocol);
|
||||
|
||||
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
|
||||
const exists = !!keys.find(key => key.key.includes(protocol));
|
||||
const exists = keys.some(key => key.key.includes(protocol));
|
||||
expect(exists).to.equal(true);
|
||||
});
|
||||
|
||||
@@ -1193,7 +1193,7 @@ describe('app module', () => {
|
||||
app.removeAsDefaultProtocolClient(protocol);
|
||||
|
||||
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
|
||||
const exists = !!keys.find(key => key.key.includes(protocol));
|
||||
const exists = keys.some(key => key.key.includes(protocol));
|
||||
expect(exists).to.equal(false);
|
||||
});
|
||||
|
||||
@@ -1209,7 +1209,7 @@ describe('app module', () => {
|
||||
app.removeAsDefaultProtocolClient(protocol);
|
||||
|
||||
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
|
||||
const exists = !!keys.find(key => key.key.includes(protocol));
|
||||
const exists = keys.some(key => key.key.includes(protocol));
|
||||
expect(exists).to.equal(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ ifdescribe(process.platform !== 'linux')('cross-site frame sandboxing', () => {
|
||||
|
||||
const metrics = app.getAppMetrics();
|
||||
const isProcessSandboxed = function (pid: number) {
|
||||
const entry = metrics.filter(metric => metric.pid === pid)[0];
|
||||
const entry = metrics.find(metric => metric.pid === pid);
|
||||
return entry && entry.sandboxed;
|
||||
};
|
||||
|
||||
|
||||
@@ -442,7 +442,7 @@ function parseRIFF (string) {
|
||||
// basically, the only purpose is for encoding "Duration", which is encoded as
|
||||
// a double (considerably more difficult to encode than an integer)
|
||||
function doubleToString (num) {
|
||||
return [].slice.call(
|
||||
return Array.prototype.slice.call(
|
||||
new Uint8Array(
|
||||
(
|
||||
new Float64Array([num]) // create a float64 array
|
||||
|
||||
Reference in New Issue
Block a user