mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-11-03 20:53:59 +01:00
Use an extension method to fix Array.find don't support async callback
This commit is contained in:
parent
2ecdb00eec
commit
5d4039ea3b
@ -23,6 +23,7 @@ draft: false
|
|||||||
<script src="/js/DebugMode.js"></script>
|
<script src="/js/DebugMode.js"></script>
|
||||||
<script src="/js/numberUtils.js"></script>
|
<script src="/js/numberUtils.js"></script>
|
||||||
<script src="/js/indexDB.js"></script>
|
<script src="/js/indexDB.js"></script>
|
||||||
|
<script src="/js/ArrayExtensions.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function adjustSticky() {
|
function adjustSticky() {
|
||||||
const height = $("nav").height()
|
const height = $("nav").height()
|
||||||
@ -102,7 +103,7 @@ draft: false
|
|||||||
const subset = sub.filter(d => d.set.isSameSet(exSet))
|
const subset = sub.filter(d => d.set.isSameSet(exSet))
|
||||||
for (mol of uniq(subset.map(d => d.molecule))) {
|
for (mol of uniq(subset.map(d => d.molecule))) {
|
||||||
const submol = subset.filter(d => d.molecule === mol)
|
const submol = subset.filter(d => d.molecule === mol)
|
||||||
const source = submol.find(async (d) => {
|
const source = await submol.findAsync(async (d) => {
|
||||||
if (await d.set.getDOIAsync() === "10.1021/acs.jctc.8b01205") {
|
if (await d.set.getDOIAsync() === "10.1021/acs.jctc.8b01205") {
|
||||||
return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ"
|
return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ"
|
||||||
} else {
|
} else {
|
||||||
|
9
static/js/ArrayExtensions.js
Normal file
9
static/js/ArrayExtensions.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
if (!Array.prototype.findAsync) {
|
||||||
|
Array.prototype.findAsync = async function findAsync(asyncCallback) {
|
||||||
|
for (const item of this) {
|
||||||
|
if (await asyncCallback(item)) {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user