Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583564
subject.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
727 B
Referenced Files
None
Subscribers
None
subject.js
View Options
"use strict"
;
const
locreq
=
require
(
"locreq"
)(
__dirname
);
const
Promise
=
require
(
"bluebird"
);
const
SubjectPath
=
locreq
(
"lib/data-structures/subject-path.js"
);
function
Subject
(){}
Subject
.
prototype
=
new
function
(){
this
.
get_subject
=
function
(
subject_path
){
// This is a recursive function. It traverses the subject tree and returns
// the subject referenced by subject_path
subject_path
=
new
SubjectPath
(
subject_path
);
return
Promise
.
resolve
(
this
.
get_child_subject
(
subject_path
.
head
()))
.
then
(
function
(
child_subject
){
if
(
subject_path
.
elements
.
length
===
1
){
return
child_subject
;
}
else
{
return
child_subject
.
get_subject
(
subject_path
.
tail
());
}
});
};
};
module
.
exports
=
Subject
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 10:07 (16 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984176
Default Alt Text
subject.js (727 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment