Socket
Socket
Sign inDemoInstall

oberknecht-utils

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oberknecht-utils - npm Package Compare versions

Comparing version 1.5.4 to 1.5.5

lib-js/types/regexEscape.d.ts

1

lib-js/types/log.d.ts

@@ -32,3 +32,4 @@ export declare const logColors: {

logColorBG?: logColorValueType;
displayMS?: boolean;
};
export {};

2

lib-js/utils/createID.d.ts

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

export declare function createID(length?: number, preventDuplicates?: boolean, byPattern?: boolean, patternID_?: number[]): string;
export declare function createID(length?: number, preventDuplicates?: boolean, byPattern?: boolean, patternID_?: number[], chars_?: string): string;

@@ -5,6 +5,7 @@ "use strict";

const _1 = require(".");
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
const defaultChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
let chars = defaultChars;
const usedIDs = [];
let patternIDs = [];
function createID(length, preventDuplicates, byPattern, patternID_) {
function createID(length, preventDuplicates, byPattern, patternID_, chars_) {
let preventDuplicates_ = !(0, _1.isNullUndefined)(preventDuplicates)

@@ -15,2 +16,3 @@ ? preventDuplicates

patternIDs = patternID_ ?? patternIDs;
chars = chars_ ?? defaultChars;
let length_ = length ?? 5;

@@ -17,0 +19,0 @@ let r = "";

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

export declare function getDateParsed(date?: string | number | Date): string;
export declare function getDateParsed(date?: string | number | Date, displayMS?: boolean): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDateParsed = void 0;
function getDateParsed(date) {
function getDateParsed(date, displayMS) {
let date_ = date ??
new Date(new Date().setMinutes(new Date().getMinutes() - new Date().getTimezoneOffset()));
let r = new Date(date_);
return r.toISOString().split(".")[0].replace("T", " ");
return r
.toISOString()
.split(displayMS ? "Z" : ".")[0]
.replace("T", " ");
}
exports.getDateParsed = getDateParsed;

@@ -23,2 +23,3 @@ "use strict";

logColorBG: logOpt?.logColorBG ?? casecolors.bg[logOptOption] ?? "0",
displayMS: logOpt?.displayMS ?? true,
};

@@ -45,12 +46,11 @@ let logMsg_ = [...logMsg];

}),
(0, _1.getDateParsed)(),
(0, _1.getDateParsed)(undefined, logOpt_.displayMS),
];
logOpt = logOpt ?? 0;
const logcolorfg = `\x1b[${logOpt_.logColorFG}m`;
const logcolorbg = `\x1b[${logOpt_.logColorBG}m`;
const logm = [
`${logcolorbg}${logcolorfg} ${(0, _1.getDateParsed)()} \x1b[0m >`,
`${logcolorbg}${logcolorfg} ${(0, _1.getDateParsed)(undefined, logOpt_.displayMS)} \x1b[0m >`,
...logMsg_,
];
switch (logOpt) {
switch (logOptOption) {
default:

@@ -57,0 +57,0 @@ case 0:

@@ -5,24 +5,8 @@ "use strict";

const recreate_1 = require("./recreate");
const regexEscape_1 = require("../types/regexEscape");
function regexEscape(s) {
let r = (0, recreate_1.recreate)(s);
let escapingRegex = [
"\\",
"/",
"(",
")",
"{",
"}",
"[",
"]",
"^",
"$",
".",
"*",
"?",
"+",
"|",
];
escapingRegex.forEach((a) => (r = r.replaceAll(a, (b) => `\\${b}`)));
regexEscape_1.escapingRegex.forEach((a) => (r = r.replaceAll(a, (b) => `\\${b}`)));
return r;
}
exports.regexEscape = regexEscape;

@@ -34,2 +34,3 @@ export const logColors = {

logColorBG?: logColorValueType;
displayMS?: boolean;
};
import { isNullUndefined } from ".";
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
const defaultChars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
let chars = defaultChars;
const usedIDs = [];

@@ -10,3 +12,4 @@ let patternIDs = [];

byPattern?: boolean,
patternID_?: number[]
patternID_?: number[],
chars_?: string
) {

@@ -19,2 +22,3 @@ let preventDuplicates_ = !isNullUndefined(preventDuplicates)

patternIDs = patternID_ ?? patternIDs;
chars = chars_ ?? defaultChars;

@@ -21,0 +25,0 @@ let length_ = length ?? 5;

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

export function getDateParsed(date?: string | number | Date): string {
export function getDateParsed(
date?: string | number | Date,
displayMS?: boolean
): string {
let date_ =

@@ -11,3 +14,6 @@ date ??

let r = new Date(date_);
return r.toISOString().split(".")[0].replace("T", " ");
return r
.toISOString()
.split(displayMS ? "Z" : ".")[0]
.replace("T", " ");
}

@@ -28,2 +28,3 @@ import { concatJSON, extendedTypeof, getDateParsed } from ".";

logColorBG: logOpt?.logColorBG ?? casecolors.bg[logOptOption] ?? "0",
displayMS: logOpt?.displayMS ?? true,
};

@@ -57,7 +58,5 @@

}),
getDateParsed(),
getDateParsed(undefined, logOpt_.displayMS),
];
logOpt = logOpt ?? 0;
const logcolorfg = `\x1b[${logOpt_.logColorFG}m`;

@@ -67,7 +66,10 @@ const logcolorbg = `\x1b[${logOpt_.logColorBG}m`;

const logm = [
`${logcolorbg}${logcolorfg} ${getDateParsed()} \x1b[0m >`,
`${logcolorbg}${logcolorfg} ${getDateParsed(
undefined,
logOpt_.displayMS
)} \x1b[0m >`,
...logMsg_,
];
switch (logOpt) {
switch (logOptOption) {
default:

@@ -74,0 +76,0 @@ case 0:

import { recreate } from "./recreate";
import { escapingRegex } from "../types/regexEscape";
export function regexEscape(s: string): string {
let r = recreate(s);
let escapingRegex = [
"\\",
"/",
"(",
")",
"{",
"}",
"[",
"]",
"^",
"$",
".",
"*",
"?",
"+",
"|",
];

@@ -23,0 +7,0 @@ escapingRegex.forEach((a) => (r = r.replaceAll(a, (b) => `\\${b}`)));

{
"name": "oberknecht-utils",
"version": "1.5.4",
"version": "1.5.5",
"description": "Utils for oberknecht packages",

@@ -5,0 +5,0 @@ "main": "./lib-ts/utils/index",

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