|
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 |
|
@@ -132,7 +136,7 @@ function cpus() { |
132 | 136 | const result = []; |
133 | 137 | let i = 0; |
134 | 138 | while (i < data.length) { |
135 | | - result.push({ |
| 139 | + ArrayPrototypePush(result, { |
136 | 140 | model: data[i++], |
137 | 141 | speed: data[i++], |
138 | 142 | times: { |
@@ -172,15 +176,16 @@ function tmpdir() { |
172 | 176 | path = process.env.TEMP || |
173 | 177 | process.env.TMP || |
174 | 178 | (process.env.SystemRoot || process.env.windir) + '\\temp'; |
175 | | - if (path.length > 1 && path.endsWith('\\') && !path.endsWith(':\\')) |
176 | | - path = path.slice(0, -1); |
| 179 | + if (path.length > 1 && StringPrototypeEndsWith(path, '\\') && |
| 180 | + !StringPrototypeEndsWith(path, ':\\')) |
| 181 | + path = StringPrototypeSlice(path, 0, -1); |
177 | 182 | } else { |
178 | 183 | path = safeGetenv('TMPDIR') || |
179 | 184 | safeGetenv('TMP') || |
180 | 185 | safeGetenv('TEMP') || |
181 | 186 | '/tmp'; |
182 | | - if (path.length > 1 && path.endsWith('/')) |
183 | | - path = path.slice(0, -1); |
| 187 | + if (path.length > 1 && StringPrototypeEndsWith(path, '/')) |
| 188 | + path = StringPrototypeSlice(path, 0, -1); |
184 | 189 | } |
185 | 190 |
|
186 | 191 | return path; |
@@ -217,7 +222,7 @@ function getCIDR(address, netmask, family) { |
217 | 222 | groupLength = 16; |
218 | 223 | } |
219 | 224 |
|
220 | | - const parts = netmask.split(split); |
| 225 | + const parts = StringPrototypeSplit(netmask, split); |
221 | 226 | for (var i = 0; i < parts.length; i++) { |
222 | 227 | if (parts[i] !== '') { |
223 | 228 | const binary = NumberParseInt(parts[i], range); |
@@ -272,7 +277,7 @@ function networkInterfaces() { |
272 | 277 |
|
273 | 278 | const existing = result[name]; |
274 | 279 | if (existing !== undefined) |
275 | | - existing.push(entry); |
| 280 | + ArrayPrototypePush(existing, entry); |
276 | 281 | else |
277 | 282 | result[name] = [entry]; |
278 | 283 | } |
|
0 commit comments