restafary 10.1.1 → 11.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.
package/ChangeLog CHANGED
@@ -1,3 +1,17 @@
1
+ 2022.04.22, v11.0.0
2
+
3
+ feature:
4
+ - (package) flop v11.0.0
5
+ - (package) eslint v8.13.0
6
+ - (package) putout v25.15.0
7
+ - (package) madrun v9.0.2
8
+ - (package) eslint-plugin-putout v14.11.0
9
+ - (restafary) drop support of node < 16
10
+ - (package) win32 v7.0.0
11
+ - (package) eslint-plugin-putout v8.1.0
12
+ - (package) putout v18.9.1
13
+
14
+
1
15
  2021.03.02, v10.1.1
2
16
 
3
17
  feature:
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Restafary [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
1
+ # Restafary [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
2
2
 
3
3
  **REST** for **CRUD** file operations.
4
4
 
@@ -18,7 +18,7 @@
18
18
  |:------------|:--------|:--------------|:------------------|:------------------------------|
19
19
  |`fs` |`GET` | | |get file or dir content |
20
20
  | | |`sort` | |sort dir content by `name`, |
21
- | | | | |`size`, or `time` |
21
+ | | | | |`size` or `time` |
22
22
  | | |`order` | |order of sorting, can be: |
23
23
  | | | | |`asc` or `desc` |
24
24
  | | |`raw` | |get file or raw dir content |
@@ -46,8 +46,8 @@ const port = 1337;
46
46
  const ip = '0.0.0.0';
47
47
 
48
48
  app.use(restafary({
49
- prefix: '/fs', // default
50
- root: '/', // default, can be string or function
49
+ prefix: '/fs', // default
50
+ root: '/', // default, can be string or function
51
51
  }));
52
52
 
53
53
  app.use(express.static(__dirname));
@@ -61,8 +61,6 @@ MIT
61
61
  [NPMIMGURL]: https://img.shields.io/npm/v/restafary.svg?style=flat
62
62
  [BuildStatusURL]: https://github.com/coderaiser/node-restafary/actions?query=workflow%3A%22Node+CI%22 "Build Status"
63
63
  [BuildStatusIMGURL]: https://github.com/coderaiser/node-restafary/workflows/Node%20CI/badge.svg
64
- [DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/node-restafary.svg?style=flat
65
64
  [LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
66
65
  [NPMURL]: https://npmjs.org/package/restafary "npm"
67
- [DependencyStatusURL]: https://david-dm.org/coderaiser/node-restafary "Dependency Status"
68
66
  [LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
package/dist/restafary.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.restafary=t():e.restafary=t()}(globalThis,(function(){return(()=>{"use strict";var e={360:e=>{let t="/api/v1/fs";const r=e=>"function"==typeof e;function o({url:e,data:t,method:r,callback:o}){!function(e,t){const{url:r,data:o,method:n}=e,a=new XMLHttpRequest;if("function"!=typeof t)throw Error("Callback should be function!");a.open(n,r,!0),a.addEventListener("error",t),a.addEventListener("load",(()=>{if(a.status>=200&&a.status<400)return t(null,a.responseText);t(Error(a.responseText))})),a.send(o)}({method:r,data:t,url:n(e)},o)}function n(e){return encodeURI(e).replace(/#/g,"%23")}e.exports.prefix=e=>{t=e},e.exports.delete=(e,n,a)=>{!a&&r(n)&&(a=n,n=null),o({method:"DELETE",url:t+e,data:n,callback:a})},e.exports.patch=(e,n,a)=>{!a&&r(n)&&(a=n,n=null),o({method:"PATCH",url:t+e,data:n,callback:a})},e.exports.write=(e,n,a)=>{!a&&r(n)&&(a=n,n=null),o({method:"PUT",url:t+e,data:n,callback:a})},e.exports.read=(e,r)=>{o({method:"GET",url:t+e,callback:r})},e.exports._escape=n}},t={};return function r(o){if(t[o])return t[o].exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}(360)})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.restafary=t():e.restafary=t()}(globalThis,(()=>(()=>{"use strict";var e={46:e=>{let t="/api/v1/fs";const r=e=>"function"==typeof e;function o(e){let{url:t,data:r,method:o,callback:n}=e;!function(e,t){const{url:r,data:o,method:a}=e,n=new XMLHttpRequest;if("function"!=typeof t)throw Error("Callback should be function!");n.open(a,r,!0),n.addEventListener("error",t),n.addEventListener("load",(()=>{if(n.status>=200&&n.status<400)return t(null,n.responseText);t(Error(n.responseText))})),n.send(o)}({method:o,data:r,url:a(t)},n)}function a(e){return encodeURI(e).replace(/#/g,"%23")}e.exports.prefix=e=>{t=e},e.exports.delete=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"DELETE",url:t+e,data:a,callback:n})},e.exports.patch=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"PATCH",url:t+e,data:a,callback:n})},e.exports.write=(e,a,n)=>{!n&&r(a)&&(n=a,a=null),o({method:"PUT",url:t+e,data:a,callback:n})},e.exports.read=(e,r)=>{o({method:"GET",url:t+e,callback:r})},e.exports._escape=a}},t={};return function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}(46)})()));
2
2
  //# sourceMappingURL=restafary.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["file://restafary/webpack/universalModuleDefinition","file://restafary/client/index.js","file://restafary/webpack/bootstrap","file://restafary/webpack/startup"],"names":["root","factory","exports","module","define","amd","globalThis","FS","isFunc","a","sendRequest","url","data","method","callback","params","request","XMLHttpRequest","Error","open","addEventListener","status","responseText","send","ajax","escape","str","encodeURI","replace","prefix","delete","patch","write","read","_escape","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iB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XF,EAAY,CACRG,OAAQ,MACRF,IAAKJ,EAAKI,EACVC,OACAE,cAIRX,EAAOD,QAAQ+B,KAAO,CAACtB,EAAKG,KACxBJ,EAAY,CACRG,OAAQ,MACRF,IAAKJ,EAAKI,EACVG,cAgBRX,EAAOD,QAAQgC,QAAUT,ICtErBU,EAA2B,G,OAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUnC,QAG3C,IAAIC,EAASgC,EAAyBE,GAAY,CAGjDnC,QAAS,IAOV,OAHAoC,EAAoBD,GAAUlC,EAAQA,EAAOD,QAASkC,GAG/CjC,EAAOD,QClBWkC,CAAoB,M","file":"restafary.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"restafary\"] = factory();\n\telse\n\t\troot[\"restafary\"] = factory();\n})(globalThis, function() {\nreturn ","'use strict';\n\nlet FS = '/api/v1/fs';\nconst isFunc = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports.delete = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({\n method,\n data,\n url: escape(url),\n }, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str)\n .replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n const request = new XMLHttpRequest();\n \n if (typeof callback !== 'function')\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\nvar __webpack_exports__ = __webpack_require__(360);\n// This entry module used 'module' so it can't be inlined\n"],"sourceRoot":""}
1
+ {"version":3,"file":"restafary.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,IARtB,CASGK,YAAY,I,iCCPf,IAAIC,EAAK,aACT,MAAMC,EAAUC,GAAmB,mBAANA,EAwD7B,SAASC,EAAT,GAAoD,IAA/B,IAACC,EAAD,KAAMC,EAAN,OAAYC,EAAZ,SAAoBC,GAAW,GAkBpD,SAAcC,EAAQD,GAClB,MAAM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AyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAanC,QAGrB,IAAIC,EAAS+B,EAAyBE,GAAY,CAGjDlC,QAAS,IAOV,OAHAqC,EAAoBH,GAAUjC,EAAQA,EAAOD,QAASiC,GAG/ChC,EAAOD,QClBWiC,CAAoB,K","sources":["file://restafary/webpack/universalModuleDefinition","file://restafary/client/index.js","file://restafary/webpack/bootstrap","file://restafary/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"restafary\"] = factory();\n\telse\n\t\troot[\"restafary\"] = factory();\n})(globalThis, () => {\nreturn ","'use strict';\n\nlet FS = '/api/v1/fs';\nconst isFunc = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports.delete = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({\n method,\n data,\n url: escape(url),\n }, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str)\n .replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n const request = new XMLHttpRequest();\n \n if (typeof callback !== 'function')\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(46);\n"],"names":["root","factory","exports","module","define","amd","globalThis","FS","isFunc","a","sendRequest","url","data","method","callback","params","request","XMLHttpRequest","Error","open","addEventListener","status","responseText","send","ajax","escape","str","encodeURI","replace","prefix","patch","write","read","_escape","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -15,7 +15,7 @@
15
15
  exports["restafary"] = factory();
16
16
  else
17
17
  root["restafary"] = factory();
18
- })(globalThis, function() {
18
+ })(globalThis, () => {
19
19
  return /******/ (() => { // webpackBootstrap
20
20
  /******/ "use strict";
21
21
  /******/ var __webpack_modules__ = ({
@@ -26,7 +26,7 @@ return /******/ (() => { // webpackBootstrap
26
26
  \*************************/
27
27
  /***/ ((module) => {
28
28
 
29
- eval("\n\nlet FS = '/api/v1/fs';\nconst isFunc = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports.delete = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({\n method,\n data,\n url: escape(url),\n }, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str)\n .replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n const request = new XMLHttpRequest();\n \n if (typeof callback !== 'function')\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n\n\n\n//# sourceURL=file://restafary/client/index.js");
29
+ eval("\n\nlet FS = '/api/v1/fs';\nconst isFunc = (a) => typeof a === 'function';\n\nmodule.exports.prefix = (prefix) => {\n FS = prefix;\n};\n\nmodule.exports[\"delete\"] = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'DELETE',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.patch = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PATCH',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.write = (url, data, callback) => {\n if (!callback && isFunc(data)) {\n callback = data;\n data = null;\n }\n \n sendRequest({\n method: 'PUT',\n url: FS + url,\n data,\n callback,\n });\n};\n\nmodule.exports.read = (url, callback) => {\n sendRequest({\n method: 'GET',\n url: FS + url,\n callback,\n });\n};\n\nfunction sendRequest({url, data, method, callback}) {\n ajax({\n method,\n data,\n url: escape(url),\n }, callback);\n}\n\n/*\n * when we send ajax request -\n * no need in hash so we escape #\n */\nmodule.exports._escape = escape;\nfunction escape(str) {\n return encodeURI(str)\n .replace(/#/g, '%23');\n}\n\nfunction ajax(params, callback) {\n const {\n url,\n data,\n method,\n } = params;\n const request = new XMLHttpRequest();\n \n if (typeof callback !== 'function')\n throw Error('Callback should be function!');\n \n const load = () => {\n if (request.status >= 200 && request.status < 400)\n return callback(null, request.responseText);\n \n callback(Error(request.responseText));\n };\n \n request.open(method, url, true);\n request.addEventListener('error', callback);\n request.addEventListener('load', load);\n \n request.send(data);\n}\n\n\n\n//# sourceURL=file://restafary/client/index.js");
30
30
 
31
31
  /***/ })
32
32
 
@@ -38,8 +38,9 @@ eval("\n\nlet FS = '/api/v1/fs';\nconst isFunc = (a) => typeof a === 'function';
38
38
  /******/ // The require function
39
39
  /******/ function __webpack_require__(moduleId) {
40
40
  /******/ // Check if module is in cache
41
- /******/ if(__webpack_module_cache__[moduleId]) {
42
- /******/ return __webpack_module_cache__[moduleId].exports;
41
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
42
+ /******/ if (cachedModule !== undefined) {
43
+ /******/ return cachedModule.exports;
43
44
  /******/ }
44
45
  /******/ // Create a new module (and put it into the cache)
45
46
  /******/ var module = __webpack_module_cache__[moduleId] = {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "restafary",
3
- "version": "10.1.1",
3
+ "version": "11.0.0",
4
+ "type": "commonjs",
4
5
  "description": "REST for CRUD file operations",
5
6
  "main": "server/restafary.js",
6
7
  "engines": {
7
- "node": ">=14"
8
+ "node": ">=16"
8
9
  },
9
10
  "babel": {
10
11
  "presets": [
@@ -35,7 +36,7 @@
35
36
  "currify": "^4.0.0",
36
37
  "file-type": "^16.2.0",
37
38
  "files-io": "^4.0.0",
38
- "flop": "^10.0.0",
39
+ "flop": "^11.0.0",
39
40
  "jonny": "^3.0.0",
40
41
  "mellow": "^3.0.1",
41
42
  "mime-types": "^2.1.28",
@@ -45,7 +46,7 @@
45
46
  "pullout": "^4.0.0",
46
47
  "redzip": "^2.1.0",
47
48
  "try-to-catch": "^3.0.0",
48
- "win32": "^6.0.0"
49
+ "win32": "^7.0.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@babel/cli": "^7.0.0",
@@ -55,15 +56,15 @@
55
56
  "babel-loader": "^8.0.0",
56
57
  "c8": "^7.6.0",
57
58
  "coveralls": "^3.0.0",
58
- "eslint": "^7.16.0",
59
+ "eslint": "^8.13.0",
59
60
  "eslint-plugin-node": "^11.0.0",
60
- "eslint-plugin-putout": "^7.0.0",
61
+ "eslint-plugin-putout": "^14.11.0",
61
62
  "express": "^4.13.4",
62
- "madrun": "^8.2.0",
63
+ "madrun": "^9.0.2",
63
64
  "mock-require": "^3.0.2",
64
65
  "nodemon": "^2.0.2",
65
66
  "nyc": "^15.0.0",
66
- "putout": "^15.3.1",
67
+ "putout": "^25.15.0",
67
68
  "serve-once": "^2.0.0",
68
69
  "supertape": "^5.0.0",
69
70
  "webpack": "^5.11.0",
package/server/fs/get.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const {Readable} = require('stream');
4
4
 
5
5
  const {parse} = require('querystring');
6
- const check = require ('checkup');
6
+ const check = require('checkup');
7
7
  const ashify = require('ashify');
8
8
  const {read} = require('win32');
9
9
  const {readSize} = require('redzip');
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const isFn = (a) => typeof a === 'function';
4
+
3
5
  const {
4
6
  basename,
5
7
  extname,
@@ -139,7 +141,7 @@ async function onFS(params, callback) {
139
141
 
140
142
  let root;
141
143
 
142
- if (typeof params.root === 'function')
144
+ if (isFn(params.root))
143
145
  root = params.root();
144
146
  else
145
147
  root = params.root;