Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async run(options) {
const url = options.urls[0];
const timestamp = options.utc ? dayjs.utc() : dayjs();
const { storageManager, resultUrls } = resultsStorage(
url,
timestamp,
options.outputFolder,
options.resultBaseURL,
options.useHash
);
// Setup logging
const logDir = await storageManager.createDirectory('logs');
logging.configure(options, logDir);
// Tell the world what we are using
log.info(
'Versions OS: %s nodejs: %s sitespeed.io: %s browsertime: %s coach: %s',
os.platform() + ' ' + os.release(),
{newsSearch['@graph'].map(item =>
<div>
<h3>{item.title}</h3>
<h4>{dayjs.utc(item.date_created).format('MMMM D, YYYY')}</h4>
<div>{item.news_excerpt}</div>
<div>
<a for="" aria-label="{`View" href="{item['@id']}">Read more</a>
</div>
</div>
)}
setTime(current, start = dayjs.utc(current).subtract(12, "hour").toISOString(), stop = dayjs.utc(current).add(7, "day").toISOString()) {
this.viewer.clock.startTime = Cesium.JulianDate.fromIso8601(dayjs.utc(start).toISOString());
this.viewer.clock.stopTime = Cesium.JulianDate.fromIso8601(dayjs.utc(stop).toISOString());
this.viewer.clock.currentTime = Cesium.JulianDate.fromIso8601(dayjs.utc(current).toISOString());
if (typeof this.viewer.timeline !== "undefined") {
this.viewer.timeline.updateFromClock();
this.viewer.timeline.zoomTo(this.viewer.clock.startTime, this.viewer.clock.stopTime);
}
}
const formatTime = val => {
const now = dayjs.utc();
const then = now.subtract(val, "seconds");
const timestamp = then.toString().replace("GMT", "UTC");
const relative = now.to(then, true);
return `${relative} (${timestamp})`;
};
async function fetchBoth() {
const date = dayjs.utc().format('YYYY-MM-DD');
const [{ forgeStats: summary }, { forgeStats: trend }] = await Promise.all([
forge().getForgeStats(),
forge().getForgeStatsByHour({ date }),
]);
return { summary, trend };
}
Form2Data(form) {
let f = JSON.parse(JSON.stringify(form))
f.data.color = parseInt(f.data.color.substring(1), 16)
f.createTime = dayjs.utc(f.createTime)
f.updateTime = dayjs.utc()
return f
}
},
{context.assembly ?
<div data-test="assembly">
<dt>Assembly</dt>
<dd>{context.assembly}</dd>
</div>
: null}
{context.genome_annotation ?
<div data-test="genomeannotation">
<dt>Genome annotation</dt>
<dd>{context.genome_annotation}</dd>
</div>
: null}
{context.date_created ?
<div data-test="datecreated">
<dt>Date added</dt>
<dd>{dayjs.utc(context.date_created).format('YYYY-MM-DD')}</dd>
</div>
: null}
{context.dbxrefs && context.dbxrefs.length > 0 ?
<div data-test="externalresources">
<dt>External resources</dt>
<dd></dd>
</div>
: null}
{context.content_error_detail ?
<div data-test="contenterrordetail">
<dt>Content error detail</dt>
<dd>{context.content_error_detail}</dd>
</div>
: null}
.select((s, i) => ({
num: i,
id: s.id,
vid: s.vid,
text: s.data.text,
ip: s.ip,
createTime: dayjs.utc(s.createTime).local().format('YYYY-MM-DD HH:mm:ss'),
updateTime: dayjs.utc(s.updateTime).local().format('YYYY-MM-DD HH:mm:ss'),
isDelete: s.isDelete ? '是' : '否'
}))
.toArray()
(value => {
if (value) {
if (value.text || value.hyperlink) {
return value.hyperlink || value.text || '';
}
if (value.formula || value.result) {
return value.result || '';
}
if (value instanceof Date) {
if (dateFormat) {
return dateUTC ? dayjs.utc(value).format(dateFormat) : dayjs(value).format(dateFormat);
}
return dateUTC ? dayjs.utc(value).format() : dayjs(value).format();
}
if (value.error) {
return value.error;
}
if (typeof value === 'object') {
return JSON.stringify(value);
}
}
return value;
});
dateFormat(date, format, localize = true) {
if (!localize) {
return dayjs.utc(date).format(format);
}
return dayjs.utc(date).local().format(format);
},