Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
16b2d9e8
Commit
16b2d9e8
authored
Feb 19, 2020
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
add .ofStringAliasArray and .ofStringListArray to Column
parent
7a643342
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-data/db/column.ts
+9
-1
9 additions, 1 deletion
src/mol-data/db/column.ts
with
9 additions
and
1 deletion
src/mol-data/db/column.ts
+
9
−
1
View file @
16b2d9e8
...
...
@@ -37,7 +37,7 @@ namespace Column {
export
type
Coordinate
=
{
'
@type
'
:
'
coord
'
,
T
:
number
}
&
Base
<
'
float
'
>
export
type
Tensor
=
{
'
@type
'
:
'
tensor
'
,
T
:
Tensors
.
Data
,
space
:
Tensors
.
Space
,
baseType
:
Int
|
Float
}
&
Base
<
'
tensor
'
>
export
type
Aliased
<
T
>
=
{
'
@type
'
:
'
aliased
'
,
T
:
T
}
&
Base
<
'
str
'
|
'
int
'
>
export
type
Aliased
<
T
>
=
{
'
@type
'
:
'
aliased
'
,
T
:
T
}
&
Base
<
T
extends
string
?
'
str
'
:
'
int
'
>
export
type
List
<
T
extends
number
|
string
>
=
{
'
@type
'
:
'
list
'
,
T
:
T
[],
separator
:
string
,
itemParse
:
(
x
:
string
)
=>
T
}
&
Base
<
'
list
'
>
export
const
str
:
Str
=
{
'
@type
'
:
'
str
'
,
T
:
''
,
valueType
:
'
str
'
};
...
...
@@ -137,6 +137,14 @@ namespace Column {
return
arrayColumn
({
array
,
schema
:
Schema
.
str
});
}
export
function
ofStringAliasArray
<
T
extends
string
>
(
array
:
ArrayLike
<
T
>
)
{
return
arrayColumn
<
Schema
.
Aliased
<
T
>>
({
array
,
schema
:
Schema
.
Aliased
(
Schema
.
str
)
});
}
export
function
ofStringListArray
<
T
extends
string
>
(
array
:
ArrayLike
<
T
[]
>
,
separator
=
'
,
'
)
{
return
arrayColumn
<
Schema
.
List
<
T
>>
({
array
,
schema
:
Schema
.
List
<
T
>
(
separator
,
x
=>
x
as
T
)
});
}
export
function
ofIntTokens
(
tokens
:
Tokens
)
{
const
{
count
,
data
,
indices
}
=
tokens
return
lambdaColumn
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment