|
22 | 22 | 'use strict';
|
23 | 23 |
|
24 | 24 | const {
|
| 25 | + ArrayPrototypePush, |
25 | 26 | Float64Array,
|
26 | 27 | NumberParseInt,
|
27 | 28 | ObjectDefineProperties,
|
| 29 | + StringPrototypeEndsWith, |
| 30 | + StringPrototypeSlice, |
| 31 | + StringPrototypeSplit, |
28 | 32 | SymbolToPrimitive,
|
29 | 33 | } = primordials;
|
30 | 34 |
|
@@ -104,7 +108,7 @@ function cpus() {
|
104 | 108 | const result = [];
|
105 | 109 | let i = 0;
|
106 | 110 | while (i < data.length) {
|
107 |
| - result.push({ |
| 111 | + ArrayPrototypePush(result, { |
108 | 112 | model: data[i++],
|
109 | 113 | speed: data[i++],
|
110 | 114 | times: {
|
@@ -135,15 +139,16 @@ function tmpdir() {
|
135 | 139 | path = process.env.TEMP ||
|
136 | 140 | process.env.TMP ||
|
137 | 141 | (process.env.SystemRoot || process.env.windir) + '\\temp';
|
138 |
| - if (path.length > 1 && path.endsWith('\\') && !path.endsWith(':\\')) |
139 |
| - path = path.slice(0, -1); |
| 142 | + if (path.length > 1 && StringPrototypeEndsWith(path, '\\') && |
| 143 | + !StringPrototypeEndsWith(path, ':\\')) |
| 144 | + path = StringPrototypeSlice(path, 0, -1); |
140 | 145 | } else {
|
141 | 146 | path = safeGetenv('TMPDIR') ||
|
142 | 147 | safeGetenv('TMP') ||
|
143 | 148 | safeGetenv('TEMP') ||
|
144 | 149 | '/tmp';
|
145 |
| - if (path.length > 1 && path.endsWith('/')) |
146 |
| - path = path.slice(0, -1); |
| 150 | + if (path.length > 1 && StringPrototypeEndsWith(path, '/')) |
| 151 | + path = StringPrototypeSlice(path, 0, -1); |
147 | 152 | }
|
148 | 153 |
|
149 | 154 | return path;
|
@@ -177,7 +182,7 @@ function getCIDR(address, netmask, family) {
|
177 | 182 | groupLength = 16;
|
178 | 183 | }
|
179 | 184 |
|
180 |
| - const parts = netmask.split(split); |
| 185 | + const parts = StringPrototypeSplit(netmask, split); |
181 | 186 | for (var i = 0; i < parts.length; i++) {
|
182 | 187 | if (parts[i] !== '') {
|
183 | 188 | const binary = NumberParseInt(parts[i], range);
|
@@ -221,7 +226,7 @@ function networkInterfaces() {
|
221 | 226 |
|
222 | 227 | const existing = result[name];
|
223 | 228 | if (existing !== undefined)
|
224 |
| - existing.push(entry); |
| 229 | + ArrayPrototypePush(existing, entry); |
225 | 230 | else
|
226 | 231 | result[name] = [entry];
|
227 | 232 | }
|
|
0 commit comments