• Custom User Avatar

    Nice for object oriented programming.

  • Custom User Avatar

    Additional random tests have been added.

    Mutating the input has been addressed via coppying the randomized array and create a fixed structure from it.

  • Custom User Avatar

    Thank you for your contribution, I've address these issues.

  • Custom User Avatar

    The random tests are not random at all, they just shuffles the same input and run multiple times.

    Also, mutating the input breaks all the tests, because there are no fixed tests.

  • Custom User Avatar


    • the initial solution contains two typos: ..., typed; ... -> ..., type: ...

    • I'm getting this with the full test suite:

      test.ts:20:43 - error TS2554: Expected 1 arguments, but got 2.
      20         if(n.type === 'folder') format(ar,n);
  • Custom User Avatar

    Oooh, that's funny.
    Quite cheeky.

    I've adjusted the tests to account of manipulation of the original array.

  • Default User Avatar
  • Custom User Avatar

    Found the issue and have resolved it.
    Thank you for you contribution.

  • Custom User Avatar

    Verbage updated.
    Thank you for you contribution.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Good Suggestion, configuration has been added

  • Custom User Avatar
    expected { name: 'root', type: 'folder', …(1) } to deeply equal { name: 'root', type: 'folder', …(1) }

    Please add chai.config.truncateThreshold = 0; to the test code, otherwise the expected and actual values are hidden.

  • Custom User Avatar

    Error when submitting solution:

    TSError: ⨯ Unable to compile TypeScript:
    test.ts:21:49 - error TS2554: Expected 1 arguments, but got 2.
    21         if(arr[i].type === 'folder') format(arr,arr[i]);
        at createTSError (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:859:12)
        at reportTSError (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:863:19)
        at getOutput (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1077:36)
        at Object.compile (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1433:41)
        at Module.m._compile (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1617:30)
        at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
        at Object.require.extensions.<computed> [as .ts] (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1621:12)
        at Module.load (node:internal/modules/cjs/loader:1037:32)
        at Function.Module._load (node:internal/modules/cjs/loader:878:12)
        at Module.require (node:internal/modules/cjs/loader:1061:19)
        at require (node:internal/modules/cjs/helpers:103:18)
        at Object.exports.requireOrImport (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/nodejs/esm-utils.js:53:16)
        at async Object.exports.loadFilesAsync (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
        at async singleRun (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/cli/run-helpers.js:125:3)
        at async Object.exports.handler (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/cli/run.js:370:5)

    What is the second argument to format() for ?

  • Custom User Avatar

    It is safe to assume that all objects in the flat array will have parent fields that match a folder name in the same array, OR be set to 'root' if it is to be placed under the returned root level FileFolderObject.

    This is insufficient; for example,

      { name:'folder', parent:'root',    type:'folder' },
      { name:'folder1', parent:'folder2', type:'folder' },
      { name:'folder2', parent:'folder1', type:'folder' },

    would be valid in this definition but does not form a valid tree.

  • Default User Avatar

    valueOf isn't taught in alot of js class these days. theres a possibility it's on its way to deprecation.

    it's hard to answer because using a value as a function isn't "best practice", or taught.

  • Loading more items...