Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9349319
sort.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
684 B
Subscribers
None
sort.js
View Options
import
{
Selection
}
from
"./index.js"
;
export
default
function
(
compare
)
{
if
(
!
compare
)
compare
=
ascending
;
function
compareNode
(
a
,
b
)
{
return
a
&&
b
?
compare
(
a
.
__data__
,
b
.
__data__
)
:
!
a
-
!
b
;
}
for
(
var
groups
=
this
.
_groups
,
m
=
groups
.
length
,
sortgroups
=
new
Array
(
m
),
j
=
0
;
j
<
m
;
++
j
)
{
for
(
var
group
=
groups
[
j
],
n
=
group
.
length
,
sortgroup
=
sortgroups
[
j
]
=
new
Array
(
n
),
node
,
i
=
0
;
i
<
n
;
++
i
)
{
if
(
node
=
group
[
i
])
{
sortgroup
[
i
]
=
node
;
}
}
sortgroup
.
sort
(
compareNode
);
}
return
new
Selection
(
sortgroups
,
this
.
_parents
).
order
();
}
function
ascending
(
a
,
b
)
{
return
a
<
b
?
-
1
:
a
>
b
?
1
:
a
>=
b
?
0
:
NaN
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Jul 4 2025, 7:17 PM (7 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3269774
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment