@@ -14,7 +14,6 @@ function parseJSON (data) {
14
14
}
15
15
}
16
16
17
- // Extracted from: http://stackoverflow.com/questions/5999998/how-can-i-check-if-a-javascript-variable-is-function-type
18
17
function isFunction ( data ) {
19
18
var getType = { } ;
20
19
return data && getType . toString . call ( data ) === '[object Function]' ;
@@ -39,30 +38,18 @@ function newGuid () {
39
38
s4 ( ) + '-' + s4 ( ) + s4 ( ) + s4 ( ) ;
40
39
}
41
40
42
- // This function sanitizes the name to only allow the following: ([A-Za-z][A-Za-z0-9]*)(\.[A-Za-z][A-Za-z0-9]*)*
43
41
function sanitizeName ( name ) {
44
42
var sanitizedName = name ;
45
43
46
- // Remove all invalid characters
47
44
sanitizedName = sanitizedName . replace ( / [ ^ A - Z a - z 0 - 9 \. ] / g, '' ) ;
48
45
49
46
var currentLength ;
50
47
do {
51
48
currentLength = sanitizedName . length ;
52
-
53
- // If the name starts with a number, remove the number
54
49
sanitizedName = sanitizedName . replace ( / ^ [ 0 - 9 ] / , '' ) ;
55
-
56
- // If the name starts with a dot, remove the dot
57
50
sanitizedName = sanitizedName . replace ( / ^ \. / , '' ) ;
58
-
59
- // If there is a number right after a dot, remove the number
60
51
sanitizedName = sanitizedName . replace ( / \. [ 0 - 9 ] / g, '.' ) ;
61
-
62
- // If there are two consecutive dots, remove one dot
63
52
sanitizedName = sanitizedName . replace ( / \. \. / g, '.' ) ;
64
-
65
- // if the name ends with a dot, remove the dot
66
53
sanitizedName = sanitizedName . replace ( / \. $ / , '' ) ;
67
54
}
68
55
while ( currentLength > sanitizedName . length ) ;
@@ -74,7 +61,6 @@ function sanitizeName (name) {
74
61
return sanitizedName ;
75
62
}
76
63
77
- // Function to remove duplicates from any array
78
64
function removeDupesInPlace ( arr , comparator ) {
79
65
for ( var i = 0 ; i < arr . length ; i ++ ) {
80
66
for ( var j = arr . length - 1 ; j > i ; j -- ) {
0 commit comments