Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-vis

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-vis - npm Package Compare versions

Comparing version 1.11.5 to 1.11.6

4

dist/plot/crosshair.js

@@ -19,2 +19,4 @@ 'use strict';

var _dataUtils = require('../utils/data-utils');
var _scalesUtils = require('../utils/scales-utils');

@@ -58,3 +60,3 @@

title: 'x',
value: value.x
value: (0, _dataUtils.transformValueToString)(value.x)
};

@@ -61,0 +63,0 @@ }

@@ -19,2 +19,4 @@ 'use strict';

var _dataUtils = require('../utils/data-utils');
var _scalesUtils = require('../utils/scales-utils');

@@ -94,3 +96,3 @@

return Object.keys(value).map(function getProp(key) {
return { title: key, value: value[key] };
return { title: key, value: (0, _dataUtils.transformValueToString)(value[key]) };
});

@@ -97,0 +99,0 @@ }

@@ -319,4 +319,4 @@ 'use strict';

onNearestXY(value, {
innerX: foundPoint.x,
innerY: foundPoint.y,
innerX: foundPoint[0],
innerY: foundPoint[1],
index: foundPoint.index,

@@ -323,0 +323,0 @@ event: event.nativeEvent

@@ -173,4 +173,4 @@ 'use strict';

var positionInPixels = {
x: x({ x: seriesComponent.x }),
y: y({ y: seriesComponent.y })
x: x(seriesComponent),
y: y(seriesComponent)
};

@@ -177,0 +177,0 @@ var innerComponent = getInnerComponent({

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -8,2 +8,3 @@ Object.defineProperty(exports, "__esModule", {

exports.addValueToArray = addValueToArray;
exports.transformValueToString = transformValueToString;
// Copyright (c) 2016 - 2017 Uber Technologies, Inc.

@@ -55,2 +56,11 @@ //

return result;
}
/**
* Transforms a value ( number or date ) to a string.
* @param {Date | number} value The value as date or number.
* @returns {string | number} The value as string.
*/
function transformValueToString(value) {
return Object.prototype.toString.call(value) === '[object Date]' ? value.toDateString() : value;
}

@@ -7,6 +7,6 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _SCALE_FUNCTIONS;

@@ -180,2 +180,37 @@

/**
* This is a workaround for issue that ordinal scale
* does not have invert method implemented in d3-scale.
* @param {Object} Ordinal d3-scale object.
* @returns {void}
* @private
*/
function addInvertFunctionToOrdinalScaleObject(scale) {
if (scale.invert) {
return;
}
scale.invert = function invert(value) {
var _scale$range = scale.range(),
_scale$range2 = _slicedToArray(_scale$range, 2),
lower = _scale$range2[0],
upper = _scale$range2[1];
var start = Math.min(lower, upper);
var stop = Math.max(lower, upper);
if (value < start + scale.padding() * scale.step()) {
return scale.domain()[0];
}
if (value > stop - scale.padding() * scale.step()) {
return scale.domain()[scale.domain().length - 1];
}
var index = Math.floor((value - start - scale.padding() * scale.step()) / scale.step());
return scale.domain()[index];
};
}
/**
* Crate a scale function from the scale object.

@@ -205,2 +240,3 @@ * @param {Object} scaleObject Scale object.

scale.padding(0.5);
addInvertFunctionToOrdinalScaleObject(scale);
}

@@ -207,0 +243,0 @@ return scale;

@@ -35,2 +35,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import { transformValueToString } from '../utils/data-utils';
import { getAttributeFunctor } from '../utils/scales-utils';

@@ -48,3 +50,3 @@

title: 'x',
value: value.x
value: transformValueToString(value.x)
};

@@ -51,0 +53,0 @@ }

@@ -35,2 +35,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import { transformValueToString } from '../utils/data-utils';
import { getAttributeFunctor } from '../utils/scales-utils';

@@ -84,3 +86,3 @@

return Object.keys(value).map(function getProp(key) {
return { title: key, value: value[key] };
return { title: key, value: transformValueToString(value[key]) };
});

@@ -87,0 +89,0 @@ }

@@ -308,4 +308,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

onNearestXY(value, {
innerX: foundPoint.x,
innerY: foundPoint.y,
innerX: foundPoint[0],
innerY: foundPoint[1],
index: foundPoint.index,

@@ -312,0 +312,0 @@ event: event.nativeEvent

@@ -156,4 +156,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var positionInPixels = {
x: x({ x: seriesComponent.x }),
y: y({ y: seriesComponent.y })
x: x(seriesComponent),
y: y(seriesComponent)
};

@@ -160,0 +160,0 @@ var innerComponent = getInnerComponent({

@@ -47,2 +47,11 @@ // Copyright (c) 2016 - 2017 Uber Technologies, Inc.

return result;
}
/**
* Transforms a value ( number or date ) to a string.
* @param {Date | number} value The value as date or number.
* @returns {string | number} The value as string.
*/
export function transformValueToString(value) {
return Object.prototype.toString.call(value) === '[object Date]' ? value.toDateString() : value;
}

@@ -0,5 +1,5 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _SCALE_FUNCTIONS;

@@ -149,2 +149,37 @@

/**
* This is a workaround for issue that ordinal scale
* does not have invert method implemented in d3-scale.
* @param {Object} Ordinal d3-scale object.
* @returns {void}
* @private
*/
function addInvertFunctionToOrdinalScaleObject(scale) {
if (scale.invert) {
return;
}
scale.invert = function invert(value) {
var _scale$range = scale.range(),
_scale$range2 = _slicedToArray(_scale$range, 2),
lower = _scale$range2[0],
upper = _scale$range2[1];
var start = Math.min(lower, upper);
var stop = Math.max(lower, upper);
if (value < start + scale.padding() * scale.step()) {
return scale.domain()[0];
}
if (value > stop - scale.padding() * scale.step()) {
return scale.domain()[scale.domain().length - 1];
}
var index = Math.floor((value - start - scale.padding() * scale.step()) / scale.step());
return scale.domain()[index];
};
}
/**
* Crate a scale function from the scale object.

@@ -174,2 +209,3 @@ * @param {Object} scaleObject Scale object.

scale.padding(0.5);
addInvertFunctionToOrdinalScaleObject(scale);
}

@@ -176,0 +212,0 @@ return scale;

{
"name": "react-vis",
"version": "1.11.5",
"version": "1.11.6",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "Visualization Team <visualization@uber.com>",

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

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