Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');
const moment = require('moment');
const timeStamp = moment().format('LLLL Z');
const universalTime = moment.utc().format('LLLL Z');
const banner = `Generated on ${universalTime}`;
// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseRelativeAssetPaths = publicPath === './';
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);
function probeResponse (latestSchema) {
const newXMLns = latestSchema[0].xmlns
const newTime = moment.utc().format()
const dvcHeader = latestSchema[0].device.$
const dvcDescription = latestSchema[0].device.Description
const dataItems = latestSchema[0].device.DataItems
const components = latestSchema[0].device.Components
const instanceId = 0
const assets = dataStorage.assetBuffer.toArray()
let dataItem // TODO Update the value
let newJSON = {}
const Device = [{ $:
{ name: dvcHeader.name, uuid: dvcHeader.uuid },
Description: dvcDescription
}]
if (dataItems !== undefined) {
for (let j = 0; j < dataItems.length; j++) {
export const mostRecentCreated = (
latestTime: number,
current: Pick
) => {
const time: number = moment.utc(current.created).valueOf(); // Unix time (milliseconds)
return latestTime > time ? latestTime : time;
};
updatePanelDateRange = (timeScale, deltaX, draggerPosition, overDrag) => {
// const startTime = performance.now();
let gridWidth = this.state.gridWidth;
let deque = this.state.deque;
let numberOfVisibleTiles = Math.floor(this.state.numberOfVisibleTiles * 0.25);
let overDragGrids = Math.ceil(overDrag / gridWidth);
let draggerVisible = this.state.draggerVisible;
let draggerVisibleB = this.state.draggerVisibleB;
let draggerDateActual = moment.utc(this.state.draggerTimeState);
let dateArrayAdd;
let dateArray;
let transform;
// let overDragGrids = Math.ceil(overDrag / gridWidth);
// numberOfVisibleTiles = Math.floor(numberOfVisibleTiles * 0.25);
if (deltaX > 0) { // dragging right - exposing past dates
// PHASE 1
let firstDateInRange = moment.utc(deque.peekFront().rawDate);
dateArrayAdd = this.getDateArray(numberOfVisibleTiles + 1 + overDragGrids, -1, timeScale, firstDateInRange);
// PHASE 2
this.removeBackMultipleInPlace(deque, numberOfVisibleTiles + 1 + overDragGrids);
deque.unshift(...dateArrayAdd.dates);
dateArray = deque.toArray();
// PHASE X - can be done in any order
transform = this.state.currentTransformX - ((numberOfVisibleTiles + 1 + overDragGrids) * gridWidth);
} else { // dragging left - exposing future dates
it('should distribute the next points value across the preceeding nulls', function () {
const seriesList = getSeriesList('', [
[moment.utc('1980-01-01T00:00:00.000Z'), 10],
[moment.utc('1981-07-01T00:00:00.000Z'), null],
[moment.utc('1982-01-01T00:00:00.000Z'), null],
[moment.utc('1983-01-01T00:00:00.000Z'), 60],
[moment.utc('1984-01-01T00:00:00.000Z'), 50],
]);
return invoke(fn, [seriesList, 'scale']).then(function (r) {
expect(_.map(r.output.list[0].data, 1)).to.eql([10, 20, 20, 20, 50]);
});
});
});
it('fills holes in the data', function () {
const data = [
[moment.utc('1980', 'YYYY').valueOf(), 10],
[moment.utc('1983', 'YYYY').valueOf(), 40],
[moment.utc('1984', 'YYYY').valueOf(), 50],
];
const target = [
[moment.utc('1980', 'YYYY').valueOf(), null],
[moment.utc('1981', 'YYYY').valueOf(), null],
[moment.utc('1982', 'YYYY').valueOf(), null],
[moment.utc('1983', 'YYYY').valueOf(), null],
[moment.utc('1984', 'YYYY').valueOf(), null],
];
expect(_.map(fn(data, target), 1)).to.eql([10, 10, 10, 40, 50]);
});
function createStreamName(customName: string) {
const hash = Math.random()
.toString(36)
.substring(7)
const time = moment.utc()
return `${customName}-${time.format()}-${hash}`.replace(/(\*)|(:)/g, '-')
}
resolve: ({ start_at, end_at }) => {
const start = moment.utc(start_at).subtract(7, "days")
const end = moment.utc(end_at).add(7, "days")
return moment.utc().isBetween(start, end)
},
},
minusTimeUnit = () => {
let timeScaleSelected = this.state.timeScaleSelectValue;
let frontDate = moment.utc(this.state.deque.peekFront().rawDate);
let backDate = moment.utc(this.state.deque.peekBack().rawDate);
let increment = this.state.increment;
let draggerTimeState = moment.utc(this.state.draggerTimeState, 'YYYY-MM-DDTHH:mm:ss.SSSZ');
let draggerTimeStateSubtracted = draggerTimeState.clone().subtract(increment, timeScaleSelected);
let isBetween = draggerTimeState.isBetween(frontDate, backDate, null, '[]');
if (isBetween) {
let gridWidth = this.state.gridWidth;
let timeScale = this.state.timeScale;
let pixelsToAddToDragger = Math.abs(frontDate.diff(draggerTimeState, timeScale, true) * gridWidth);
let pixelsToAddToDraggerNew = Math.abs(frontDate.diff(draggerTimeStateSubtracted, timeScale, true) * gridWidth);
let pixelsToAddBasedOnFrontDate = pixelsToAddToDraggerNew - pixelsToAddToDragger;
this.setState({
draggerPosition: this.state.draggerPosition + pixelsToAddBasedOnFrontDate,
draggerTimeState: draggerTimeStateSubtracted.format(),
redLineOffset: this.state.redLineOffset + pixelsToAddBasedOnFrontDate
},
this.props.incrementDate(timeScaleSelected, -increment));
} else {