Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
16e37788
Commit
16e37788
authored
Jul 13, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jul 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove runtime check for case that can be checked via types
parent
45aca203
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
12 deletions
+2
-12
index.ts
src/annotator/config/index.ts
+2
-6
index-test.js
src/annotator/config/test/index-test.js
+0
-6
No files found.
src/annotator/config/index.ts
View file @
16e37788
...
...
@@ -31,15 +31,11 @@ type ConfigDefinitionMap = Record<string, ConfigDefinition>;
*/
type
Context
=
'sidebar'
|
'notebook'
|
'profile'
|
'annotator'
|
'all'
;
function
throwInvalidContext
(
context
:
string
):
never
{
throw
new
Error
(
`Invalid application context used: "
${
context
}
"`
);
}
/**
* Returns the configuration keys that are relevant to a particular context.
*/
function
configurationKeys
(
context
:
Context
):
string
[]
{
const
contexts
=
{
const
contexts
:
Record
<
Exclude
<
Context
,
'all'
>
,
string
[]
>
=
{
annotator
:
[
'clientUrl'
,
'contentInfoBanner'
,
...
...
@@ -82,7 +78,7 @@ function configurationKeys(context: Context): string[] {
return
Object
.
values
(
contexts
).
flat
();
}
return
contexts
[
context
]
??
throwInvalidContext
(
context
)
;
return
contexts
[
context
];
}
const
getHostPageSetting
:
ValueGetter
=
(
settings
,
name
)
=>
...
...
src/annotator/config/test/index-test.js
View file @
16e37788
...
...
@@ -282,10 +282,4 @@ describe('annotator/config/index', () => {
});
});
});
it
(
`throws an error if an invalid context was passed`
,
()
=>
{
assert
.
throws
(()
=>
{
getConfig
(
'fake'
,
'WINDOW'
);
},
'Invalid application context used: "fake"'
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment