Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F12655661
subject-path.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
subject-path.js
View Options
"use strict"
;
const
clone
=
require
(
"clone"
);
const
SubjectPath
=
function
(
subject_path
){
if
(
SubjectPath
instanceof
SubjectPath
){
return
SubjectPath
;
}
this
.
elements
=
[];
this
.
subject_type_instance
=
null
;
this
.
_init
(
subject_path
);
};
SubjectPath
.
prototype
.
_init
=
function
(
subject_path
){
this
.
_load_path_elements
(
subject_path
);
};
SubjectPath
.
prototype
.
_load_path_elements
=
function
(
subject_path
){
if
(
subject_path
instanceof
SubjectPath
){
this
.
_from_path
(
subject_path
);
}
else
if
(
typeof
subject_path
===
"string"
){
this
.
_from_string
(
subject_path
);
}
else
if
(
subject_path
instanceof
Array
){
this
.
_from_array
(
subject_path
);
}
};
SubjectPath
.
prototype
.
_from_string
=
function
(
description_string
){
this
.
elements
=
description_string
.
split
(
"."
);
};
SubjectPath
.
prototype
.
_from_array
=
function
(
description_array
){
this
.
elements
=
clone
(
description_array
);
};
SubjectPath
.
prototype
.
_from_path
=
function
(
subject
){
this
.
elements
=
clone
(
subject
.
elements
);
};
SubjectPath
.
prototype
.
clone
=
function
(){
const
cloned_elements
=
clone
(
this
.
elements
);
return
new
SubjectPath
(
cloned_elements
);
};
SubjectPath
.
prototype
.
tail
=
function
(){
return
new
SubjectPath
(
this
.
elements
.
slice
(
1
));
};
SubjectPath
.
prototype
.
head
=
function
(){
return
this
.
elements
[
0
];
};
module
.
exports
=
SubjectPath
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 28, 15:05 (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1038980
Default Alt Text
subject-path.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment