Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22393512
subject.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
699 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
.
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
application/javascript
Expires
Fri, Nov 27, 16:06 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1227567
Default Alt Text
subject.js (699 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline