Socket
Socket
Sign inDemoInstall

@barchart/common-js

Package Overview
Dependencies
Maintainers
12
Versions
454
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barchart/common-js - npm Package Compare versions

Comparing version 4.28.1 to 4.29.0

35

api/failures/FailureReason.js

@@ -13,4 +13,4 @@ const assert = require('./../../lang/assert'),

/**
* Describes all of the reasons for API failure. Since there can be multiple reasons, the reasons are
* stored in a tree structure.
* Describes all of the reasons for API failure. Since there can be multiple
* reasons, the reasons are stored in a tree structure.
*

@@ -24,4 +24,4 @@ * @public

this._head = new Tree();
this._current = this._head;
this._root = new Tree();
this._current = this._root;
}

@@ -55,7 +55,18 @@

* @public
* @param {Boolean=} previous
* @returns {FailureReason} - The current instance, allowing for method chaining.
*/
reset() {
this._current = this._head;
reset(previous) {
assert.argumentIsOptional(previous, 'previous', Boolean);
let node;
if (previous && this._current.getIsInner()) {
node = this._current.getParent();
} else {
node = this._root;
}
this._current = node;
return this;

@@ -71,3 +82,3 @@ }

format() {
const reasons = this._head.toJSObj((item) => {
const reasons = this._root.toJSObj((item) => {
const formatted = { };

@@ -83,3 +94,3 @@

return formatted;
});
}, true);

@@ -100,3 +111,3 @@ return reasons.children;

return this._head.search(item => item.type === type, false, false) !== null;
return this._root.search(item => item.type === type, false, false) !== null;
}

@@ -112,3 +123,3 @@

getIsSevere() {
return this._head.search(item => item.type.severe, false, false) !== null;
return this._root.search(item => item.type.severe, false, false) !== null;
}

@@ -124,3 +135,3 @@

getErrorCode() {
const node = this._head.search(item => item.type.error !== null, true, false);
const node = this._root.search(item => item.type.error !== null, true, false);

@@ -177,3 +188,3 @@ if (node !== null) {

reason._head.walk((item) => {
reason._root.walk((item) => {
let code = FailureType.getHttpStatusCode(item.type);

@@ -180,0 +191,0 @@

{
"name": "@barchart/common-js",
"version": "4.28.1",
"version": "4.29.0",
"description": "Library of common JavaScript utilities",

@@ -5,0 +5,0 @@ "author": {

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