Total Complexity | 5 |
Complexity/F | 5 |
Lines of Code | 30 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | /** |
||
59 | if (typeof faulancer === 'undefined') { |
||
|
|||
60 | faulancer = {}; |
||
61 | } |
||
62 | |||
63 | faulancer.namespace = function(namespace) |
||
64 | { |
||
65 | 'use strict'; |
||
66 | |||
67 | var parts = namespace.split('.'), |
||
68 | parent = faulancer, |
||
69 | i; |
||
70 | |||
71 | // strip redundant leading global |
||
72 | if (parts[0] === "faulancer") { |
||
73 | parts = parts.slice(1); |
||
74 | } |
||
75 | |||
76 | for (i = 0; i < parts.length; i += 1) { |
||
77 | |||
78 | // create a property if it doesn't exist |
||
79 | if (typeof parent[parts[i]] === "undefined") { |
||
80 | parent[parts[i]] = {}; |
||
81 | } |
||
82 | |||
83 | parent = parent[parts[i]]; |
||
84 | |||
85 | } |
||
86 | |||
87 | return parent; |
||
88 | }; |
||
89 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.