• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

richardgirges / express-fileupload / #333

24 May 2022 01:09AM UTC coverage: 94.551%. Remained the same
#333

push

richardgirges
1.4.0

137 of 150 branches covered (0.0%)

295 of 312 relevant lines covered (94.55%)

903.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/processNested.js
1
const { isSafeFromPollution } = require("./utilities");
1✔
2

3
module.exports = function(data){
1✔
4
  if (!data || data.length < 1) return Object.create(null);
6✔
5

6
  let d = Object.create(null),
5✔
7
    keys = Object.keys(data);
5✔
8

9
  for (let i = 0; i < keys.length; i++) {
5✔
10
    let key = keys[i],
19✔
11
      value = data[key],
19✔
12
      current = d,
19✔
13
      keyParts = key
19✔
14
        .replace(new RegExp(/\[/g), '.')
15
        .replace(new RegExp(/\]/g), '')
16
        .split('.');
17

18
    for (let index = 0; index < keyParts.length; index++){
19✔
19
      let k = keyParts[index];
36✔
20

21
      // Ensure we don't allow prototype pollution
22
      if (!isSafeFromPollution(current, k)) {
36✔
23
        continue;
2✔
24
      }
25

26
      if (index >= keyParts.length - 1){
34✔
27
        current[k] = value;
19✔
28
      } else {
29
        if (!current[k]) current[k] = !isNaN(keyParts[index + 1]) ? [] : Object.create(null);
15✔
30
        current = current[k];
15✔
31
      }
32
    }
33
  }
34
  return d;
5✔
35
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc