fx 33.0.0 → 35.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +15 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -233,6 +233,14 @@ async function run(json, code) {
233
233
  if (typeof x === 'object' && x !== null) return Object.values(x)
234
234
  throw new Error(`Cannot get values of ${typeof x}`)
235
235
  }
236
+
237
+ function list(x) {
238
+ if (Array.isArray(x)) {
239
+ for (const y of x) console.log(y)
240
+ return skip
241
+ }
242
+ throw new Error(`Cannot list ${typeof x}`)
243
+ }
236
244
  }
237
245
 
238
246
  async function read(fd = 0) {
@@ -264,8 +272,12 @@ async function read(fd = 0) {
264
272
  }
265
273
 
266
274
  function isFile(fs, path) {
267
- const stat = fs.statSync(path, {throwIfNoEntry: false})
268
- return stat !== undefined && stat.isFile()
275
+ try {
276
+ const stat = fs.statSync(path, {throwIfNoEntry: false})
277
+ return stat !== undefined && stat.isFile()
278
+ } catch (err) {
279
+ return false
280
+ }
269
281
  }
270
282
 
271
283
  function sleepSync(ms) {
@@ -282,6 +294,7 @@ function* readLine(stdin) {
282
294
  buffer += ch
283
295
  }
284
296
  }
297
+ if (buffer.length > 0) yield buffer
285
298
  return buffer
286
299
  }
287
300
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fx",
3
- "version": "33.0.0",
3
+ "version": "35.0.0",
4
4
  "bin": {
5
5
  "fx": "index.js"
6
6
  },