Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
jio
Commits
9e02ff51
Commit
9e02ff51
authored
Aug 29, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Metadata.js check method added
parent
d073d692
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
src/jio/core/Metadata.js
src/jio/core/Metadata.js
+60
-0
No files found.
src/jio/core/Metadata.js
View file @
9e02ff51
...
...
@@ -23,6 +23,20 @@ Metadata.prototype.format = function () {
return
this
.
update
(
this
.
_dict
);
};
Metadata
.
prototype
.
check
=
function
()
{
var
k
;
for
(
k
in
this
.
_dict
)
{
if
(
this
.
_dict
.
hasOwnProperty
(
k
))
{
if
(
k
[
0
]
!==
'
_
'
)
{
if
(
!
Metadata
.
checkValue
(
this
.
_dict
[
k
]))
{
return
false
;
}
}
}
}
return
true
;
};
Metadata
.
prototype
.
update
=
function
(
metadata
)
{
var
k
;
for
(
k
in
metadata
)
{
...
...
@@ -251,4 +265,50 @@ Metadata.normalizeValue = function (value) {
}
};
Metadata
.
checkArray
=
function
(
value
)
{
var
i
;
for
(
i
=
0
;
i
<
value
.
length
;
i
+=
1
)
{
if
(
Metadata
.
isDict
(
value
[
i
]))
{
if
(
!
Metadata
.
checkObject
(
value
[
i
]))
{
return
false
;
}
}
else
if
(
!
Metadata
.
isContent
(
value
[
i
]))
{
return
false
;
}
}
return
true
;
};
Metadata
.
checkObject
=
function
(
value
)
{
var
i
,
ok
=
false
;
for
(
i
in
value
)
{
if
(
value
.
hasOwnProperty
(
i
))
{
if
(
Metadata
.
isContent
(
value
[
i
]))
{
if
(
i
===
'
content
'
)
{
ok
=
true
;
}
}
else
{
return
false
;
}
}
}
if
(
ok
===
false
)
{
return
false
;
}
return
true
;
};
Metadata
.
checkValue
=
function
(
value
)
{
if
(
Metadata
.
isContent
(
value
))
{
return
true
;
}
if
(
Array
.
isArray
(
value
))
{
return
Metadata
.
checkArray
(
value
);
}
if
(
Metadata
.
isDict
(
value
))
{
return
Metadata
.
checkObject
(
value
);
}
return
false
;
};
exports
.
Metadata
=
Metadata
;
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