Socket
Socket
Sign inDemoInstall

vega-lite

Package Overview
Dependencies
Maintainers
2
Versions
470
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-lite - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

44

package.json
{
"name": "vega-lite",
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat",
"version": "1.1.1",
"version": "1.1.2",
"collaborators": [

@@ -57,28 +57,28 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)",

"devDependencies": {
"browser-sync": "^2.12.8",
"browserify": "^13.0.1",
"browserify-versionify": "^1.0.6",
"chai": "^3.5.0",
"cheerio": "^0.20.0",
"exorcist": "^0.4.0",
"istanbul": "^0.4.3",
"browser-sync": "~2.12.8",
"browserify": "~13.0.1",
"browserify-versionify": "~1.0.6",
"chai": "~3.5.0",
"cheerio": "~0.20.0",
"exorcist": "~0.4.0",
"istanbul": "~0.4.3",
"json-diff": "^0.3.1",
"mocha": "^2.4.5",
"nodemon": "^1.9.2",
"source-map-support": "^0.4.0",
"tsify": "^0.16.0",
"tslint": "^3.10.2",
"mocha": "~2.4.5",
"nodemon": "~1.9.2",
"source-map-support": "~0.4.0",
"tsify": "~0.16.0",
"tslint": "~3.10.2",
"typescript": "^1.8.10",
"typescript-json-schema": "^0.1.1",
"uglify-js": "^2.6.2",
"vega": "^2.6.0",
"typescript-json-schema": "~0.1.1",
"uglify-js": "~2.6.2",
"vega": "~2.6.0",
"vega-datasets": "vega/vega-datasets#gh-pages",
"watchify": "^3.7.0",
"yaml-front-matter": "^3.4.0",
"z-schema": "^3.17.0"
"watchify": "~3.7.0",
"yaml-front-matter": "~3.4.0",
"z-schema": "~3.17.0"
},
"dependencies": {
"datalib": "^1.7.0",
"json-stable-stringify": "^1.0.1",
"yargs": "^4.7.1"
"datalib": "~1.7.0",
"json-stable-stringify": "~1.0.1",
"yargs": "~4.7.1"
},

@@ -85,0 +85,0 @@ "browserify": {

@@ -111,5 +111,5 @@ export enum ScaleType {

/**
* The domain of the scale, representing the set of data values. For quantitative data, this can take the form of a two-element array with minimum and maximum values. For ordinal/categorical data, this may be an array of valid input values. The domain may also be specified by a reference to a data source.
* The domain of the scale, representing the set of data values. For quantitative data, this can take the form of a two-element array with minimum and maximum values. For ordinal/categorical data, this may be an array of valid input values.
*/
domain?: string | number[] | string[]; // TODO: declare vgDataDomain
domain?: number[] | string[]; // TODO: declare vgDataDomain
/**

@@ -116,0 +116,0 @@ * The range of the scale, representing the set of visual values. For numeric values, the range can take the form of a two-element array with minimum and maximum values. For ordinal or quantized data, the range may by an array of desired output values, which are mapped to elements in the specified domain. For ordinal scales only, the range can be defined using a DataRef: the range values are then drawn dynamically from a backing data set.

@@ -49,2 +49,39 @@ "use strict";

exports.isSingleTimeUnit = isSingleTimeUnit;
function convert(unit, date) {
var result = new Date(0, 0, 1, 0, 0, 0, 0);
exports.SINGLE_TIMEUNITS.forEach(function (singleUnit) {
if (containsTimeUnit(unit, singleUnit)) {
switch (singleUnit) {
case TimeUnit.DAY:
throw new Error('Cannot convert to TimeUnits containing \'day\'');
case TimeUnit.YEAR:
result.setFullYear(date.getFullYear());
break;
case TimeUnit.QUARTER:
result.setMonth((Math.floor(date.getMonth() / 3)) * 3);
break;
case TimeUnit.MONTH:
result.setMonth(date.getMonth());
break;
case TimeUnit.DATE:
result.setDate(date.getDate());
break;
case TimeUnit.HOURS:
result.setHours(date.getHours());
break;
case TimeUnit.MINUTES:
result.setMinutes(date.getMinutes());
break;
case TimeUnit.SECONDS:
result.setSeconds(date.getSeconds());
break;
case TimeUnit.MILLISECONDS:
result.setMilliseconds(date.getMilliseconds());
break;
}
}
});
return result;
}
exports.convert = convert;
exports.MULTI_TIMEUNITS = [

@@ -51,0 +88,0 @@ TimeUnit.YEARQUARTER,

@@ -16,2 +16,5 @@ import {COLUMN, ROW, SHAPE, COLOR, Channel} from './channel';

YEARMONTH = 'yearmonth' as any,
// Note: don't add MONTH DATE because it will be incorrect
// since days on a leap year will be shifted by one if
// we only add
YEARMONTHDATE = 'yearmonthdate' as any,

@@ -53,2 +56,46 @@ YEARMONTHDATEHOURS = 'yearmonthdatehours' as any,

/**
* Converts a date to only have the measurements relevant to the specified unit
* i.e. ('yearmonth', '2000-12-04 07:58:14') -> '2000-12-01 00:00:00'
* Note: the base date is Jan 01 1900 00:00:00
*/
export function convert(unit: TimeUnit, date: Date): Date {
const result: Date = new Date(0, 0, 1, 0, 0, 0, 0); // start with uniform date
SINGLE_TIMEUNITS.forEach(function(singleUnit) {
if (containsTimeUnit(unit, singleUnit)) {
switch (singleUnit) {
case TimeUnit.DAY:
throw new Error('Cannot convert to TimeUnits containing \'day\'');
case TimeUnit.YEAR:
result.setFullYear(date.getFullYear());
break;
case TimeUnit.QUARTER:
// indicate quarter by setting month to be the first of the quarter i.e. may (4) -> april (3)
result.setMonth((Math.floor(date.getMonth() / 3)) * 3);
break;
case TimeUnit.MONTH:
result.setMonth(date.getMonth());
break;
case TimeUnit.DATE:
result.setDate(date.getDate());
break;
case TimeUnit.HOURS:
result.setHours(date.getHours());
break;
case TimeUnit.MINUTES:
result.setMinutes(date.getMinutes());
break;
case TimeUnit.SECONDS:
result.setSeconds(date.getSeconds());
break;
case TimeUnit.MILLISECONDS:
result.setMilliseconds(date.getMilliseconds());
break;
}
}
});
return result;
}
export const MULTI_TIMEUNITS = [

@@ -55,0 +102,0 @@ TimeUnit.YEARQUARTER,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc