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

@boost/internal

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/internal - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

./cjs/index.cjs

2

dts/color.d.ts

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

export declare type ColorFormatter = (message: string | {
export type ColorFormatter = (message: string | {
toString: () => string;

@@ -3,0 +3,0 @@ }) => string;

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

export declare type Errors = Record<string, string>;
export type Errors = Record<string, string>;
export interface ScopedError<Code extends string = string> {

@@ -3,0 +3,0 @@ code: Code | 'UNKNOWN_ERROR';

// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: esm
import debug from 'debug';
/* eslint-disable no-magic-numbers, sort-keys */
// https://github.com/chalk/ansi-styles/blob/master/index.js#L75
function createColor(open) {
return message => `\u001B[${open}m${String(message)}\u001B[39m`;
}
const color = {

@@ -22,13 +23,9 @@ // States

};
function sentenceCase(value) {
return String(value).replace(/[A-Z]/gu, match => ` ${match.toLocaleLowerCase()}`).trim();
}
debug.formatters.S = sentenceCase;
function createInternalDebugger(namespace) {
return debug(`boost:${namespace}`);
}
const internalErrors = {

@@ -39,3 +36,2 @@ INVALID_SCOPE_NAME: 'Error scope must be 3 characters and all uppercase.',

const TOKEN_PATTERN = /\{(\d+)\}/gu;
function createScopedError(scope, name, errors) {

@@ -46,10 +42,7 @@ function msg(code, messages, params = []) {

}
return `${messages[code].replace(TOKEN_PATTERN, (match, index) => String(params[index]))} [${scope}:${code}]`;
}
if (process.env.NODE_ENV !== "production" && (scope.length !== 3 || scope !== scope.toUpperCase())) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
return class InternalError extends Error {

@@ -61,4 +54,5 @@ constructor(code, params) {

this.code = code;
this.name = name; // If a message was not loaded, we are throwing an unknown error
this.name = name;
// If a message was not loaded, we are throwing an unknown error
if (!this.message) {

@@ -69,18 +63,13 @@ this.code = 'UNKNOWN_ERROR';

}
};
}
let envVars = {};
if (typeof global.process !== 'undefined') {
if (global.process !== undefined) {
envVars = process.env;
} else if (typeof global.window !== 'undefined') {
} else if (global.window !== undefined) {
// @ts-expect-error Allow type mismatch
envVars = window;
}
function env(key, value) {
const name = `BOOSTJS_${key}`;
if (value === null) {

@@ -90,3 +79,2 @@ delete envVars[name];

}
if (typeof value === 'string') {

@@ -96,7 +84,5 @@ envVars[name] = value;

}
return envVars[name];
}
export { color, createInternalDebugger, createScopedError, env, sentenceCase };
//# sourceMappingURL=index.js.map
// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: lib
'use strict';

@@ -8,18 +9,14 @@

});
const debug = require('debug');
const _interopDefault = e => e && e.__esModule ? e : {
default: e
};
const debug__default = /*#__PURE__*/_interopDefault(debug);
const debug__default = /*#__PURE__*/_interopDefault(debug);
/* eslint-disable no-magic-numbers, sort-keys */
// https://github.com/chalk/ansi-styles/blob/master/index.js#L75
function createColor(open) {
return message => `\u001B[${open}m${String(message)}\u001B[39m`;
}
const color = {

@@ -36,13 +33,9 @@ // States

};
function sentenceCase(value) {
return String(value).replace(/[A-Z]/gu, match => ` ${match.toLocaleLowerCase()}`).trim();
}
debug__default.default.formatters.S = sentenceCase;
function createInternalDebugger(namespace) {
return debug__default.default(`boost:${namespace}`);
}
const internalErrors = {

@@ -53,3 +46,2 @@ INVALID_SCOPE_NAME: 'Error scope must be 3 characters and all uppercase.',

const TOKEN_PATTERN = /\{(\d+)\}/gu;
function createScopedError(scope, name, errors) {

@@ -60,10 +52,7 @@ function msg(code, messages, params = []) {

}
return `${messages[code].replace(TOKEN_PATTERN, (match, index) => String(params[index]))} [${scope}:${code}]`;
}
if (process.env.NODE_ENV !== "production" && (scope.length !== 3 || scope !== scope.toUpperCase())) {
throw new Error(msg('INVALID_SCOPE_NAME', internalErrors));
}
return class InternalError extends Error {

@@ -75,4 +64,5 @@ constructor(code, params) {

this.code = code;
this.name = name; // If a message was not loaded, we are throwing an unknown error
this.name = name;
// If a message was not loaded, we are throwing an unknown error
if (!this.message) {

@@ -83,18 +73,13 @@ this.code = 'UNKNOWN_ERROR';

}
};
}
let envVars = {};
if (typeof global.process !== 'undefined') {
if (global.process !== undefined) {
envVars = process.env;
} else if (typeof global.window !== 'undefined') {
} else if (global.window !== undefined) {
// @ts-expect-error Allow type mismatch
envVars = window;
}
function env(key, value) {
const name = `BOOSTJS_${key}`;
if (value === null) {

@@ -104,3 +89,2 @@ delete envVars[name];

}
if (typeof value === 'string') {

@@ -110,6 +94,4 @@ envVars[name] = value;

}
return envVars[name];
}
exports.color = color;

@@ -116,0 +98,0 @@ exports.createInternalDebugger = createInternalDebugger;

{
"name": "@boost/internal",
"version": "4.0.0",
"version": "4.0.1",
"type": "commonjs",

@@ -71,3 +71,3 @@ "release": "1651512176170",

},
"gitHead": "07f3182e14af6b7637b23f69fbe3c735835312a9"
"gitHead": "fd64842195c9e1c72e726800f004bdc80fa682f8"
}
let envVars: Record<string, unknown> = {};
if (typeof global.process !== 'undefined') {
if (global.process !== undefined) {
envVars = process.env;
} else if (typeof global.window !== 'undefined') {
} else if (global.window !== undefined) {
// @ts-expect-error Allow type mismatch

@@ -7,0 +7,0 @@ envVars = window;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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