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

cheminfo-types

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheminfo-types - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

480

cheminfoType.d.ts

@@ -0,98 +1,21 @@

/**
* Defines 2 limits as numbers
*/
export interface MeasurementXY<DataType extends DoubleArray = DoubleArray> {
/**
* A unique identifier for the measurement, preferably a UUID.
*/
id?: string;
/**
* Variables containing the data of the measurement.
* It must contain at least the variable `x` and `y`
*/
variables: MeasurementXYVariables<DataType>;
/**
* Title of the experiment. Often contains the sample code
*/
title?: string;
/**
* Short description about the result of the measurement
*/
description?: string;
/**
* May contain the type of data. This is practical when you have a bunch of data
* of different types
*/
dataType?: string;
settings?: {
instrument?: Instrument;
[key: string]: any;
};
meta?: Record<string, any>;
derived?: Record<string, any>;
export interface FromToXY {
from: PointXY;
to: PointXY;
}
export interface MeasurementXYVariables<
DataType extends DoubleArray = DoubleArray,
> {
a?: MeasurementVariable<DataType>;
b?: MeasurementVariable<DataType>;
c?: MeasurementVariable<DataType>;
d?: MeasurementVariable<DataType>;
e?: MeasurementVariable<DataType>;
f?: MeasurementVariable<DataType>;
g?: MeasurementVariable<DataType>;
h?: MeasurementVariable<DataType>;
i?: MeasurementVariable<DataType>;
j?: MeasurementVariable<DataType>;
k?: MeasurementVariable<DataType>;
l?: MeasurementVariable<DataType>;
m?: MeasurementVariable<DataType>;
n?: MeasurementVariable<DataType>;
o?: MeasurementVariable<DataType>;
p?: MeasurementVariable<DataType>;
q?: MeasurementVariable<DataType>;
r?: MeasurementVariable<DataType>;
s?: MeasurementVariable<DataType>;
t?: MeasurementVariable<DataType>;
u?: MeasurementVariable<DataType>;
v?: MeasurementVariable<DataType>;
w?: MeasurementVariable<DataType>;
x: MeasurementVariable<DataType>;
y: MeasurementVariable<DataType>;
z?: MeasurementVariable<DataType>;
}
/**
* Describe a variable that can only contains as data an array of number
* Quantity that is defined as range, e.g., melting point
*/
export interface MeasurementVariable<
DataType extends DoubleArray = DoubleArray,
> {
/**
* Unit of the data in the column
* @TJS-examples ["Pa", "kg"]
*/
export interface Range {
/** The lower value of some characteristic or property.*/
min: number;
/** The upper value of some characteristic or property.*/
max: number;
/** */
precision?: number;
/**A string or text indicating the unit of measurement. Useful if you cannot provide a standard unit code for unitCode. */
units?: string;
/**
* Long name of the column
*@TJS-examples ["absolute pressure"]
*/
label: string;
/**
*
*/
isDependent?: boolean;
/**
* An array containing numerical data
*/
data: DataType;
/** One letter that allows to define the variable */
symbol?: OneLetter;
/** If defined contain the minimal value of the data */
min?: number;
/** If defined contain the maximal value of the data */
max?: number;
/** If defined indicates (true or false) if the data series is monotone */
isMonotone?: boolean;
}

@@ -102,2 +25,40 @@ /**

*/
export type OneUpperCase =
| 'A'
| 'B'
| 'C'
| 'D'
| 'E'
| 'F'
| 'G'
| 'H'
| 'I'
| 'J'
| 'K'
| 'L'
| 'M'
| 'N'
| 'O'
| 'P'
| 'Q'
| 'R'
| 'S'
| 'T'
| 'U'
| 'V'
| 'W'
| 'X'
| 'Y'
| 'Z';
/**
* case we may have a text, ArrayBuffer or Uint8Array
* This type is used by the package `ensure-string` to ensure that the data
* is actually a string.
* This is very useful in the packages like `jcampconverter` or `xy-parser`
*/
export type TextData = string | BinaryData;
/**
* A type that allows one uppercase or lowercase letter
*/
export type OneLowerCase =

@@ -130,46 +91,18 @@ | 'a'

| 'z';
/**Describes the location of some object. */
export interface Location {
/** Name of the institution
* @TJS-examples ["EPFL", "Heriot-Watt University"]
/** Value with units as https://schema.org/Value */
export interface Value {
/** The value of the quantitative value or property value node.
* @TJS-examples [0, 1000, 1345.24456, -10, -100]
*/
entity: string;
/** Name or code of the building
* @TJS-examples ["I17", "Main building"]
*/
building?: string;
/**Name or code of the room in which the object is localized
* @TJS-examples ["1 B3", "Lab 1"]
*/
room?: string;
/** Internal code that is used to identify the location
* @TJS-examples ["I17 1 B3"]
*/
code: string;
value: number;
/** */
precision?: number;
/**A string or text indicating the unit of measurement. The unit could be validated in the input form based on the UN/CEFACT Common Code list */
units?: string;
}
/**
* Defines 2 limits as numbers
*/
export interface FromTo {
from: number;
to: number;
export interface PeakXYWidth {
x: number;
y: number;
width: number;
}
/**
* In order to store an array of numbers we prefer to either use native javascript
* arrays or to use Float64Array
*/
export type DoubleArray = number[] | Float64Array;
export interface DataXY<DataType extends DoubleArray = DoubleArray> {
/**
* Array of numbers on x axis
*/
x: DataType;
/**
* Array of numbers on y axis
*/
y: DataType;
}
export interface PointXY {

@@ -203,2 +136,7 @@ a?: number;

}
export interface OCLMolecule {
idCode: string;
coordinates?: string;
index?: number[]; // should be 16 numbers in fact
}
/**

@@ -209,37 +147,12 @@ * In order to store an array of numbers we prefer to either use native javascript

export type NumberArray =
| number[]
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array;
export type DoubleArray = number[] | Float64Array;
/**
* case we may have a text, ArrayBuffer or Uint8Array
* This type is used by the package `ensure-string` to ensure that the data
* is actually a string.
* This is very useful in the packages like `jcampconverter` or `xy-parser`
* Defines 2 limits as numbers
*/
export type TextData = string | BinaryData;
export interface Software {
/** Version of the software instance.
* @TJS-examples ['v0.0.1', 'rev111']
*/
version?: string;
/** The name of the item.
* @TJS-examples ['tga-analysis', 'ChemDraw']
*/
name: string;
/** A description of the item. */
description?: string;
/** If the file can be downloaded, URL to download the binary
* @TJS-examples ['https://github.com/cheminfo/tga-spectrum/releases/tag/v0.16.0']
*/
url?: string;
export interface FromTo {
from: number;
to: number;
}
export type BinaryData = ArrayBuffer | Uint8Array;

@@ -272,9 +185,20 @@ /** The instrument with which a spectrum was measured.

}
/**
* Defines 2 limits as numbers
*/
export interface FromToXY {
from: PointXY;
to: PointXY;
/**Describes the location of some object. */
export interface Location {
/** Name of the institution
* @TJS-examples ["EPFL", "Heriot-Watt University"]
*/
entity: string;
/** Name or code of the building
* @TJS-examples ["I17", "Main building"]
*/
building?: string;
/**Name or code of the room in which the object is localized
* @TJS-examples ["1 B3", "Lab 1"]
*/
room?: string;
/** Internal code that is used to identify the location
* @TJS-examples ["I17 1 B3"]
*/
code: string;
}

@@ -337,68 +261,168 @@ /**

| 'Z';
export interface OCLMolecule {
idCode: string;
coordinates?: string;
index?: number[]; // should be 16 numbers in fact
export interface Software {
/** Version of the software instance.
* @TJS-examples ['v0.0.1', 'rev111']
*/
version?: string;
/** The name of the item.
* @TJS-examples ['tga-analysis', 'ChemDraw']
*/
name: string;
/** A description of the item. */
description?: string;
/** If the file can be downloaded, URL to download the binary
* @TJS-examples ['https://github.com/cheminfo/tga-spectrum/releases/tag/v0.16.0']
*/
url?: string;
}
export interface DataXY<DataType extends DoubleArray = DoubleArray> {
/**
* Array of numbers on x axis
*/
x: DataType;
/**
* Array of numbers on y axis
*/
y: DataType;
}
/**
* A type that allows one uppercase or lowercase letter
* In order to store an array of numbers we prefer to either use native javascript
* arrays or to use Float64Array
*/
export type OneUpperCase =
| 'A'
| 'B'
| 'C'
| 'D'
| 'E'
| 'F'
| 'G'
| 'H'
| 'I'
| 'J'
| 'K'
| 'L'
| 'M'
| 'N'
| 'O'
| 'P'
| 'Q'
| 'R'
| 'S'
| 'T'
| 'U'
| 'V'
| 'W'
| 'X'
| 'Y'
| 'Z';
/** Value with units as https://schema.org/Value */
export interface Value {
/** The value of the quantitative value or property value node.
* @TJS-examples [0, 1000, 1345.24456, -10, -100]
export type NumberArray =
| number[]
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array;
/**
* Describe a variable that can only contains as data an array of number
*/
export interface MeasurementVariable<
DataType extends DoubleArray = DoubleArray,
> {
/**
* Unit of the data in the column
* @TJS-examples ["Pa", "kg"]
*/
value: number;
/** */
precision?: number;
/**A string or text indicating the unit of measurement. The unit could be validated in the input form based on the UN/CEFACT Common Code list */
units?: string;
/**
* Long name of the column
*@TJS-examples ["absolute pressure"]
*/
label: string;
/**
*
*/
isDependent?: boolean;
/**
* An array containing numerical data
*/
data: DataType;
/** One letter that allows to define the variable */
symbol?: OneLetter;
/** If defined contain the minimal value of the data */
min?: number;
/** If defined contain the maximal value of the data */
max?: number;
/**
* If defined indicates if the data series is monotonic.
* `1` means that the data is increasing.
* `-1` means that the data is decreasing.
* `0` means that the data is not monotonic.
*/
isMonotonic?: -1 | 0 | 1;
}
export interface PeakXYWidth {
x: number;
y: number;
width: number;
export interface MeasurementXY<DataType extends DoubleArray = DoubleArray> {
/**
* A unique identifier for the measurement, preferably a UUID.
*/
id?: string;
/**
* Variables containing the data of the measurement.
* It must contain at least the variable `x` and `y`
*/
variables: MeasurementXYVariables<DataType>;
/**
* Title of the experiment. Often contains the sample code
*/
title?: string;
/**
* May contain the type of data. This is practical when you have a bunch of data
* of different types
*/
dataType?: string;
settings?: {
instrument?: Instrument;
[key: string]: any;
};
meta?: Record<string, any>;
derived?: Record<string, any>;
}
export type BinaryData = ArrayBuffer | Uint8Array;
/**
* Quantity that is defined as range, e.g., melting point
*/
export interface Range {
/** The lower value of some characteristic or property.*/
min: number;
/** The upper value of some characteristic or property.*/
max: number;
/** */
precision?: number;
/**A string or text indicating the unit of measurement. Useful if you cannot provide a standard unit code for unitCode. */
units?: string;
export interface MeasurementXYVariables<
DataType extends DoubleArray = DoubleArray,
> {
a?: MeasurementVariable<DataType>;
b?: MeasurementVariable<DataType>;
c?: MeasurementVariable<DataType>;
d?: MeasurementVariable<DataType>;
e?: MeasurementVariable<DataType>;
f?: MeasurementVariable<DataType>;
g?: MeasurementVariable<DataType>;
h?: MeasurementVariable<DataType>;
i?: MeasurementVariable<DataType>;
j?: MeasurementVariable<DataType>;
k?: MeasurementVariable<DataType>;
l?: MeasurementVariable<DataType>;
m?: MeasurementVariable<DataType>;
n?: MeasurementVariable<DataType>;
o?: MeasurementVariable<DataType>;
p?: MeasurementVariable<DataType>;
q?: MeasurementVariable<DataType>;
r?: MeasurementVariable<DataType>;
s?: MeasurementVariable<DataType>;
t?: MeasurementVariable<DataType>;
u?: MeasurementVariable<DataType>;
v?: MeasurementVariable<DataType>;
w?: MeasurementVariable<DataType>;
x: MeasurementVariable<DataType>;
y: MeasurementVariable<DataType>;
z?: MeasurementVariable<DataType>;
}
export interface MinMaxContent {
z: Float64Array[];
minZ: number;
maxZ: number;
minY: number;
maxY: number;
minX: number;
maxX: number;
}
export type Data2D = Data2DFid | Data2DFt;
export interface Data2DFid {
re: MinMaxContent;
im?: MinMaxContent;
}
export interface Data2DFt {
rr: MinMaxContent;
ri?: MinMaxContent;
ir?: MinMaxContent;
ii?: MinMaxContent;
}
export interface ICPDilution {

@@ -405,0 +429,0 @@ factor?: number;

{
"name": "cheminfo-types",
"version": "1.4.0",
"version": "1.5.0",
"description": "Types for cheminfo packages and cheminfo data schema ",

@@ -34,9 +34,9 @@ "main": "./index.js",

"devDependencies": {
"eslint": "^8.1.0",
"eslint-config-cheminfo-typescript": "^10.2.2",
"eslint": "^8.28.0",
"eslint-config-cheminfo-typescript": "^11.2.2",
"js-yaml": "^4.1.0",
"prettier": "^2.4.1",
"typescript": "^4.4.4",
"typescript-json-schema": "^0.51.0"
"prettier": "^2.7.1",
"typescript": "^4.9.3",
"typescript-json-schema": "^0.55.0"
}
}

@@ -5,3 +5,2 @@ # cheminfo-types

[![build status][ci-image]][ci-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]

@@ -22,3 +21,31 @@

<details>
<summary>See example</summary>
```
import type { MeasurementXY } from 'cheminfo-types';
const measurements: MeasurementXY[] = [];
const xAxis = {
label: 'time',
units: 's',
isDependent: false,
data: [1, 2, 3],
};
const yAxis = {
label: 'current',
units: 'mA',
isDependent: true,
data: [0.1, 8, 13],
};
const firstMeasurement: MeasurementXY = {
title: 'Current Monitoring',
variables: { x: xAxis, y: yAxis },
};
measurements.push(firstMeasurement);
```
</details>
## License

@@ -32,5 +59,3 @@

[ci-url]: https://github.com/cheminfo/cheminfo-types/actions?query=workflow%3A%22Node.js+CI%22
[codecov-image]: https://img.shields.io/codecov/c/github/cheminfo/cheminfo-types.svg
[codecov-url]: https://codecov.io/gh/cheminfo/cheminfo-types
[download-image]: https://img.shields.io/npm/dm/cheminfo-types.svg
[download-url]: https://www.npmjs.com/package/cheminfo-types
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