FLUID-6346: fluid.isArrayable faultily considers any object with a property named "jquery" is an array

Metadata

Source
FLUID-6346
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2018-10-16T21:46:27.970-0400
Updated
2018-10-18T08:46:49.403-0400
Versions
N/A
Fixed Versions
N/A
Component
  1. Framework

Description

Our current implementation looks like this -

fluid.isArrayable = function (totest) {
        return totest && (totest.jquery || Object.prototype.toString.call(totest) === "[object Array]");
    };

which is extremely generous and will catch any object with a property named "jquery". We finally fell foul of this when passing our own package.json file through fluid.copy in a Kettle test and it ended up truncating the entire "devDependencies" block which now includes an entry for jQuery (for some reason).

We should tighten up this test so it cannot be tripped by any plain object.

Comments

  • Justin Obara commented 2018-10-17T09:08:04.871-0400

    jQuery is in the devDependencies because Infusion's dependencies are now pulled in from NPM. It's not in the dependencies block because the NPM package of infusion includes it in the dist builds. See FLUID-6253

  • Justin Obara commented 2018-10-17T12:23:22.519-0400

    Merged PR ( https://github.com/fluid-project/infusion/pull/940 ) into the project repo at 787f7d5e5b9a3565f4843be491e64dcc9e5fe355