Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Royer
jio
Commits
a1ed09ad
Commit
a1ed09ad
authored
Jul 17, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gidstorage useless class removed
parent
b163ec2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
104 deletions
+0
-104
src/jio.storage/gidstorage.js
src/jio.storage/gidstorage.js
+0
-104
No files found.
src/jio.storage/gidstorage.js
View file @
a1ed09ad
...
...
@@ -125,110 +125,6 @@
content_type_re
=
/^
([
a-z
]
+
\/[
a-zA-Z0-9
\+\-\.]
+
)(?:\s
*;
\s
*charset
\s
*=
\s
*
([
a-zA-Z0-9
\-]
+
))?
$/
;
function
Metadata
(
metadata
)
{
if
(
typeof
metadata
===
'
object
'
&&
!
Array
.
isArray
(
metadata
))
{
this
.
metadata
=
metadata
;
}
else
{
this
.
metadata
=
{};
}
Metadata
.
prototype
.
update
.
call
(
this
,
metadata
);
}
Metadata
.
prototype
.
update
=
function
(
metadata
)
{
var
k
;
for
(
k
in
metadata
)
{
if
(
metadata
.
hasOwnProperty
(
k
))
{
if
(
metadata
[
k
]
!==
undefined
)
{
if
(
k
[
0
]
===
'
_
'
)
{
this
.
metadata
[
k
]
=
JSON
.
parse
(
JSON
.
stringify
(
metadata
[
k
]));
}
else
{
this
.
metadata
[
k
]
=
Metadata
.
normalizeValue
(
metadata
[
k
]);
}
}
}
}
return
this
;
};
Metadata
.
prototype
.
get
=
function
(
key
)
{
return
this
.
metadata
[
key
];
};
Metadata
.
prototype
.
set
=
function
(
key
,
value
)
{
if
(
value
===
undefined
)
{
delete
this
.
metadata
[
key
];
return
this
;
}
if
(
key
[
0
]
===
'
_
'
)
{
this
.
metadata
[
key
]
=
value
;
}
else
{
this
.
metadata
[
key
]
=
Metadata
.
normalizeValue
(
value
);
}
return
this
;
};
Metadata
.
normalizeArray
=
function
(
value
)
{
var
i
;
if
(
value
.
length
===
0
)
{
return
;
}
value
=
value
.
slice
();
i
=
0
;
while
(
i
<
value
.
length
)
{
if
(
typeof
value
[
i
]
===
'
object
'
&&
!
Array
.
isArray
(
value
[
i
]))
{
value
[
i
]
=
Metadata
.
normalizeObject
(
value
[
i
]);
if
(
value
[
i
]
===
undefined
)
{
value
.
splice
(
i
,
1
);
}
else
{
i
+=
1
;
}
}
else
if
((
typeof
value
[
i
]
===
'
string
'
)
||
(
isNaN
(
value
[
i
])
&&
typeof
value
[
i
]
===
'
number
'
))
{
i
+=
1
;
}
else
{
value
.
splice
(
i
,
1
);
}
}
if
(
value
.
length
===
1
)
{
return
value
[
0
];
}
return
value
;
};
Metadata
.
normalizeObject
=
function
(
value
)
{
var
i
,
count
=
0
,
new_value
=
{};
for
(
i
in
value
)
{
if
(
value
.
hasOwnProperty
(
i
))
{
if
((
typeof
value
[
i
]
===
'
string
'
)
||
(
isNaN
(
value
[
i
])
&&
typeof
value
[
i
]
===
'
number
'
))
{
new_value
[
i
]
=
value
[
i
];
count
+=
1
;
}
}
}
if
(
new_value
.
content
===
undefined
)
{
return
;
}
if
(
count
===
1
)
{
return
new_value
.
content
;
}
return
new_value
;
};
Metadata
.
normalizeValue
=
function
(
value
)
{
if
((
typeof
value
===
'
string
'
)
||
(
isNaN
(
value
)
&&
typeof
value
===
'
number
'
))
{
return
value
;
}
if
(
Array
.
isArray
(
value
))
{
return
Metadata
.
normalizeArray
(
value
);
}
if
(
typeof
value
===
'
object
'
)
{
return
Metadata
.
normalizeObject
(
value
);
}
};
/**
* Creates a gid from metadata and constraints.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment