New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chart2music

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chart2music - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

14

dist/index.d.ts

@@ -19,3 +19,7 @@ interface AudioEngine {

}
declare type SupportedDataPointType = SimpleDataPoint | AlternateAxisDataPoint | HighLowDataPoint;
interface OHLCDataPoint extends HighLowDataPoint {
open: number;
close: number;
}
declare type SupportedDataPointType = SimpleDataPoint | AlternateAxisDataPoint | HighLowDataPoint | OHLCDataPoint;

@@ -49,3 +53,5 @@ declare type SupportedInputType = SupportedDataPointType | number;

BAR = "bar",
BAND = "band"
BAND = "band",
PIE = "pie",
CANDLESTICK = "candlestick"
}

@@ -108,4 +114,6 @@ declare type c2mCallbackType = {

private _moveNextStat;
private _playLeft;
private _playRight;
private _playAllRight;
private _playAllLeft;
private _playAllRight;
private _playCurrent;

@@ -112,0 +120,0 @@ private _onFocus;

@@ -245,2 +245,5 @@ var c2mChart = (function (exports) {

}
function isOHLCDataPoint(obj) {
return isHighLowDataPoint(obj) && "open" in obj && "close" in obj;
}

@@ -284,2 +287,10 @@ const interpolateBin = (point, min, max, bins) => {

}
else if (isOHLCDataPoint(point)) {
if (prop === "x") {
return point.x;
}
if (prop === "y") {
return Math.min(point.high, point.low, point.open, point.close);
}
}
else if (isHighLowDataPoint(point)) {

@@ -315,2 +326,10 @@ if (prop === "x") {

}
else if (isOHLCDataPoint(point)) {
if (prop === "x") {
return point.x;
}
if (prop === "y") {
return Math.max(point.high, point.low, point.open, point.close);
}
}
else if (isHighLowDataPoint(point)) {

@@ -335,2 +354,8 @@ if (prop === "x") {

const generatePointDescription = (point, xAxis, yAxis, stat) => {
if (isOHLCDataPoint(point)) {
if (typeof stat !== "undefined") {
return `${xAxis.format(point.x)}, ${yAxis.format(point[stat])}`;
}
return `${xAxis.format(point.x)}, ${yAxis.format(point.open)} - ${yAxis.format(point.high)} - ${yAxis.format(point.low)} - ${yAxis.format(point.close)}`;
}
if (isHighLowDataPoint(point)) {

@@ -366,2 +391,5 @@ if (typeof stat !== "undefined") {

}
else if (isOHLCDataPoint(row[0])) {
availableStats = ["open", "high", "low", "close"];
}
else if (isHighLowDataPoint(row[0])) {

@@ -396,2 +424,4 @@ availableStats = ["high", "low"];

SUPPORTED_CHART_TYPES["BAND"] = "band";
SUPPORTED_CHART_TYPES["PIE"] = "pie";
SUPPORTED_CHART_TYPES["CANDLESTICK"] = "candlestick";
})(SUPPORTED_CHART_TYPES || (SUPPORTED_CHART_TYPES = {}));

@@ -478,2 +508,9 @@

}
if (isOHLCDataPoint(first)) {
const failure = row.findIndex((cell) => !isOHLCDataPoint(cell));
if (failure === -1) {
return "";
}
return `The first item is an OHLC data point (x/open/high/low/close), but item index ${failure} is not (value: ${JSON.stringify(row[failure])}). All items should be of the same type.`;
}
if (isHighLowDataPoint(first)) {

@@ -596,19 +633,19 @@ const failure = row.findIndex((cell) => !isHighLowDataPoint(cell));

{
title: "Play all right",
title: "Play right",
key: "Shift+ArrowRight",
callback: () => {
clearInterval(this._playListInterval);
this._playAllRight();
this._playRight();
}
},
{
title: "Play all left",
title: "Play left",
key: "Shift+ArrowLeft",
callback: () => {
clearInterval(this._playListInterval);
this._playAllLeft();
this._playLeft();
}
},
{
title: "Cancel play all",
title: "Cancel play",
key: "Ctrl+Control",

@@ -686,15 +723,15 @@ callback: () => {

{
title: "Play all categories left",
title: "Play all left",
key: "Shift+Home",
callback: () => {
clearInterval(this._playListInterval);
this._playAlLCategoriesLeft();
this._playAllLeft();
}
},
{
title: "Play all categories right",
title: "Play all right",
key: "Shift+End",
callback: () => {
clearInterval(this._playListInterval);
this._playAlLCategoriesRight();
this._playAllRight();
}

@@ -869,3 +906,3 @@ },

}
_playAllLeft() {
_playLeft() {
const min = 0;

@@ -884,3 +921,3 @@ this._playListInterval = setInterval(() => {

}
_playAllRight() {
_playRight() {
const max = this._data[this._groupIndex].length - 1;

@@ -899,7 +936,8 @@ this._playListInterval = setInterval(() => {

}
_playAlLCategoriesRight() {
_playAllRight() {
const maxPoints = this._data[this._groupIndex].length - 1;
const maxGroups = this._data.length - 1;
this._playListInterval = setInterval(() => {
if (this._pointIndex >= maxPoints && this._groupIndex >= maxGroups) {
if (this._pointIndex >= maxPoints &&
this._groupIndex >= maxGroups) {
this._pointIndex = maxPoints;

@@ -909,2 +947,5 @@ clearInterval(this._playListInterval);

else if (this._groupIndex === maxGroups) {
this._groupIndex++;
}
else if (this._groupIndex > maxGroups) {
this._groupIndex = 0;

@@ -921,3 +962,3 @@ this._pointIndex++;

}
_playAlLCategoriesLeft() {
_playAllLeft() {
const min = 0;

@@ -930,3 +971,6 @@ const maxGroups = this._data.length - 1;

}
else if (this._groupIndex === min) {
else if (this._groupIndex === 0) {
this._groupIndex--;
}
else if (this._groupIndex < min) {
this._groupIndex = maxGroups;

@@ -971,3 +1015,3 @@ this._pointIndex--;

}
if (isHighLowDataPoint(current)) {
if (isHighLowDataPoint(current) || isOHLCDataPoint(current)) {
if (statIndex >= 0) {

@@ -974,0 +1018,0 @@ const stat = availableStats[statIndex];

@@ -45,6 +45,6 @@ import type { SonifyTypes, c2mOptions, c2mGolangReturn } from "./types";

private _moveNextStat;
private _playLeft;
private _playRight;
private _playAllRight;
private _playAllLeft;
private _playAllRight;
private _playAlLCategoriesRight;
private _playAlLCategoriesLeft;
private _playCurrent;

@@ -51,0 +51,0 @@ private _onFocus;

@@ -17,3 +17,8 @@ interface DataPoint {

export declare function isHighLowDataPoint(obj: unknown): obj is HighLowDataPoint;
export declare type SupportedDataPointType = SimpleDataPoint | AlternateAxisDataPoint | HighLowDataPoint;
export interface OHLCDataPoint extends HighLowDataPoint {
open: number;
close: number;
}
export declare function isOHLCDataPoint(obj: unknown): obj is OHLCDataPoint;
export declare type SupportedDataPointType = SimpleDataPoint | AlternateAxisDataPoint | HighLowDataPoint | OHLCDataPoint;
export {};

@@ -31,7 +31,11 @@ import type { AudioEngine } from "./audio/";

BAR = "bar",
BAND = "band"
BAND = "band",
PIE = "pie",
CANDLESTICK = "candlestick"
}
export declare type StatBundle = {
open?: number;
high?: number;
low?: number;
close?: number;
};

@@ -38,0 +42,0 @@ export declare type groupedMetadata = {

{
"name": "chart2music",
"version": "0.3.0",
"version": "0.4.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "dist/index.mjs",

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