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

@vyacheslav97/ct

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vyacheslav97/ct - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

dist/implementations/ErrorWithData/ErrorWithData.d.ts

1

dist/implementations/index.d.ts

@@ -6,1 +6,2 @@ export * from './uic';

export * from './NumberValidators';
export * from './ErrorWithData';

@@ -6,1 +6,2 @@ export * from './uic';

export * from './NumberValidators';
export * from './ErrorWithData';

@@ -5,1 +5,2 @@ export * from './uic';

export * from './algorithms';
export * from './ErrorWithData';

@@ -5,1 +5,2 @@ export * from './uic';

export * from './algorithms';
export * from './ErrorWithData';

3

package.json
{
"type": "module",
"name": "@vyacheslav97/ct",
"version": "1.0.2",
"version": "1.0.3",
"description": "",

@@ -6,0 +5,0 @@ "keywords": [

@@ -9,7 +9,6 @@ # <u>Common tools (ct, also @vyacheslav97/ct)</u>

Current version renewals (1.0.2) (see **Prerequesites** a bit below):
Current version renewals (1.0.3) (see **Prerequesites** a bit below):
- **clear** method for **Graph** and **Tree** template classes (removes all nodes from a graph or node instance)
- Input nodes validation within **Graph** and **Tree** constructors (now they are added via **addNode** method with all its checks)
- **isLeaf** boolean flag (**nodeData** property member) for **Tree** nodes, and related logic of its auto handling during adding and removing nodes (now each newly added node has **isLeaf** === **true**, if node receives some child node, its **isLeaf** then demolished)
- Imports huge bug fix (webpack and the rest became unable to assemble package due to type: module)
- **ErrorWithData** template class

@@ -32,2 +31,3 @@ Next scheduled **major** updates:

- [Mutations history template class](#mutationsHistory)
- [ErrorWithData template class](#ErrorWithDataTemplateClass)
- [Binary search procedure template](#binarySearch)

@@ -463,2 +463,47 @@ - [Duplicates search procedure template](#duplicatesSearch)

<a id="ErrorWithDataTemplateClass"></a>
## ErrorWithData template class
**ErrorWithData** template class can be imported as follows:
```ts
import {
ErrorWithData,
} from '@vyacheslav97/ct';
```
This class implements interface:
```ts
export interface ErrorBaseData {
message: string;
}
export interface ErrorWithDataInterface<DataType extends ErrorBaseData> extends Error {
errorData?: DataType;
}
```
It allows a user to provide an error some extra data of sophisticated shape
Except mentioned above, **ErrorWithData** reproduces built in JS **Error** class behaviour
<u>Usage example</u>
```ts
interface TestErrorData extends ErrorBaseData {
code: number;
}
const errorData: TestErrorData = { message: 'Test error', code: 404 };
const error = new ErrorWithData<TestErrorData>(errorData);
throw error;
```
<a id="binarySearch"></a>

@@ -465,0 +510,0 @@

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