@contrast/common
Advanced tools
Comparing version 1.25.0 to 1.26.0
@@ -33,6 +33,7 @@ "use strict"; | ||
const constants_1 = require("./constants"); | ||
const primordials_1 = require("./primordials"); | ||
__exportStar(require("./constants"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./primordials"), exports); | ||
const primordials_1 = require("./primordials"); | ||
const { StringPrototypeSplit, BufferFrom, BufferPrototypeToString } = primordials_1.primordials; | ||
/** | ||
@@ -53,3 +54,3 @@ * Returns true if the value passed is either a primitive string or a | ||
function encodeString(str) { | ||
return Buffer.from(str).toString('base64'); | ||
return BufferPrototypeToString.call(BufferFrom(str), 'base64'); | ||
} | ||
@@ -187,3 +188,3 @@ exports.encodeString = encodeString; | ||
// @ts-ignore | ||
const props = primordials_1.StringPrototypeSplit.call(name, '.'); | ||
const props = StringPrototypeSplit.call(name, '.'); | ||
for (const prop of props) { | ||
@@ -200,3 +201,3 @@ target = target?.[prop]; | ||
// @ts-ignore | ||
const props = primordials_1.StringPrototypeSplit.call(name, '.'); | ||
const props = StringPrototypeSplit.call(name, '.'); | ||
const lastProp = props.pop(); | ||
@@ -203,0 +204,0 @@ for (const p of props) { |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
export declare const ArrayPrototypeJoin: (separator?: string | undefined) => string; | ||
export declare const ArrayPrototypeSlice: (start?: number | undefined, end?: number | undefined) => any[]; | ||
export declare const BufferFrom: typeof Buffer.from; | ||
export declare const BufferPrototypeToString: (encoding?: BufferEncoding | undefined, start?: number | undefined, end?: number | undefined) => string; | ||
export declare const StringPrototypeConcat: (...strings: string[]) => string; | ||
export declare const StringPrototypeMatch: { | ||
(regexp: string | RegExp): RegExpMatchArray | null; | ||
(matcher: { | ||
[Symbol.match](string: string): RegExpMatchArray | null; | ||
}): RegExpMatchArray | null; | ||
import { inspect } from 'util'; | ||
export declare const primordials: { | ||
ArrayPrototypeJoin: (separator?: string | undefined) => string; | ||
ArrayPrototypeSlice: (start?: number | undefined, end?: number | undefined) => any[]; | ||
BufferFrom: typeof Buffer.from; | ||
BufferPrototypeToString: (encoding?: BufferEncoding | undefined, start?: number | undefined, end?: number | undefined) => string; | ||
StringPrototypeConcat: (...strings: string[]) => string; | ||
StringPrototypeMatch: { | ||
(regexp: string | RegExp): RegExpMatchArray | null; | ||
(matcher: { | ||
[Symbol.match](string: string): RegExpMatchArray | null; | ||
}): RegExpMatchArray | null; | ||
}; | ||
StringPrototypeMatchAll: (regexp: RegExp) => IterableIterator<RegExpMatchArray>; | ||
StringPrototypeReplace: { | ||
(searchValue: string | RegExp, replaceValue: string): string; | ||
(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; | ||
(searchValue: { | ||
[Symbol.replace](string: string, replaceValue: string): string; | ||
}, replaceValue: string): string; | ||
(searchValue: { | ||
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; | ||
}, replacer: (substring: string, ...args: any[]) => string): string; | ||
}; | ||
StringPrototypeReplaceAll: { | ||
(searchValue: string | RegExp, replaceValue: string): string; | ||
(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; | ||
}; | ||
StringPrototypeSlice: (start?: number | undefined, end?: number | undefined) => string; | ||
StringPrototypeSplit: { | ||
(separator: string | RegExp, limit?: number | undefined): string[]; | ||
(splitter: { | ||
[Symbol.split](string: string, limit?: number | undefined): string[]; | ||
}, limit?: number | undefined): string[]; | ||
}; | ||
StringPrototypeSubstr: (from: number, length?: number | undefined) => string; | ||
StringPrototypeSubstring: (start: number, end?: number | undefined) => string; | ||
StringPrototypeToLowerCase: () => string; | ||
StringPrototypeToUpperCase: () => string; | ||
StringPrototypeToLocaleLowerCase: (locales?: string | string[] | undefined) => string; | ||
StringPrototypeToLocaleUpperCase: (locales?: string | string[] | undefined) => string; | ||
StringPrototypeTrim: () => string; | ||
RegExpPrototypeTest: (string: string) => boolean; | ||
RegExpPrototypeExec: (string: string) => RegExpExecArray | null; | ||
FunctionPrototypeToString: () => string; | ||
JSONParse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any; | ||
JSONStringify: { | ||
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; | ||
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; | ||
}; | ||
UtilInspect: typeof inspect; | ||
}; | ||
export declare const StringPrototypeMatchAll: (regexp: RegExp) => IterableIterator<RegExpMatchArray>; | ||
export declare const StringPrototypeReplace: { | ||
(searchValue: string | RegExp, replaceValue: string): string; | ||
(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; | ||
(searchValue: { | ||
[Symbol.replace](string: string, replaceValue: string): string; | ||
}, replaceValue: string): string; | ||
(searchValue: { | ||
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; | ||
}, replacer: (substring: string, ...args: any[]) => string): string; | ||
}; | ||
export declare const StringPrototypeReplaceAll: { | ||
(searchValue: string | RegExp, replaceValue: string): string; | ||
(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; | ||
}; | ||
export declare const StringPrototypeSlice: (start?: number | undefined, end?: number | undefined) => string; | ||
export declare const StringPrototypeSplit: { | ||
(separator: string | RegExp, limit?: number | undefined): string[]; | ||
(splitter: { | ||
[Symbol.split](string: string, limit?: number | undefined): string[]; | ||
}, limit?: number | undefined): string[]; | ||
}; | ||
export declare const StringPrototypeSubstr: (from: number, length?: number | undefined) => string; | ||
export declare const StringPrototypeSubstring: (start: number, end?: number | undefined) => string; | ||
export declare const StringPrototypeToLowerCase: () => string; | ||
export declare const StringPrototypeToUpperCase: () => string; | ||
export declare const StringPrototypeTrim: () => string; | ||
export declare const RegExpPrototypeTest: (string: string) => boolean; | ||
export declare const RegExpPrototypeExec: (string: string) => RegExpExecArray | null; | ||
export declare const JSONStringify: { | ||
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; | ||
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; | ||
}; | ||
import { inspect } from 'util'; | ||
export declare const UtilInspect: typeof inspect; | ||
//# sourceMappingURL=primordials.d.ts.map |
@@ -17,31 +17,36 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UtilInspect = exports.JSONStringify = exports.RegExpPrototypeExec = exports.RegExpPrototypeTest = exports.StringPrototypeTrim = exports.StringPrototypeToUpperCase = exports.StringPrototypeToLowerCase = exports.StringPrototypeSubstring = exports.StringPrototypeSubstr = exports.StringPrototypeSplit = exports.StringPrototypeSlice = exports.StringPrototypeReplaceAll = exports.StringPrototypeReplace = exports.StringPrototypeMatchAll = exports.StringPrototypeMatch = exports.StringPrototypeConcat = exports.BufferPrototypeToString = exports.BufferFrom = exports.ArrayPrototypeSlice = exports.ArrayPrototypeJoin = void 0; | ||
// arrays | ||
exports.ArrayPrototypeJoin = Array.prototype.join; | ||
exports.ArrayPrototypeSlice = Array.prototype.slice; | ||
// buffers | ||
exports.BufferFrom = Buffer.from; | ||
exports.BufferPrototypeToString = Buffer.prototype.toString; | ||
// strings | ||
exports.StringPrototypeConcat = String.prototype.concat; | ||
exports.StringPrototypeMatch = String.prototype.match; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
exports.StringPrototypeMatchAll = String.prototype.matchAll; | ||
exports.StringPrototypeReplace = String.prototype.replace; | ||
exports.StringPrototypeReplaceAll = String.prototype.replaceAll; | ||
exports.StringPrototypeSlice = String.prototype.slice; | ||
exports.StringPrototypeSplit = String.prototype.split; | ||
exports.StringPrototypeSubstr = String.prototype.substr; | ||
exports.StringPrototypeSubstring = String.prototype.substring; | ||
exports.StringPrototypeToLowerCase = String.prototype.toLowerCase; | ||
exports.StringPrototypeToUpperCase = String.prototype.toUpperCase; | ||
exports.StringPrototypeTrim = String.prototype.trim; | ||
// regex | ||
exports.RegExpPrototypeTest = RegExp.prototype.test; | ||
exports.RegExpPrototypeExec = RegExp.prototype.exec; | ||
// misc | ||
exports.JSONStringify = JSON.stringify; | ||
exports.primordials = void 0; | ||
const util_1 = require("util"); | ||
exports.UtilInspect = util_1.inspect; | ||
exports.primordials = { | ||
// arrays | ||
ArrayPrototypeJoin: Array.prototype.join, | ||
ArrayPrototypeSlice: Array.prototype.slice, | ||
//buffers, | ||
BufferFrom: Buffer.from, | ||
BufferPrototypeToString: Buffer.prototype.toString, | ||
//strings | ||
StringPrototypeConcat: String.prototype.concat, | ||
StringPrototypeMatch: String.prototype.match, | ||
StringPrototypeMatchAll: String.prototype.matchAll, | ||
StringPrototypeReplace: String.prototype.replace, | ||
StringPrototypeReplaceAll: String.prototype.replaceAll, | ||
StringPrototypeSlice: String.prototype.slice, | ||
StringPrototypeSplit: String.prototype.split, | ||
StringPrototypeSubstr: String.prototype.substr, | ||
StringPrototypeSubstring: String.prototype.substring, | ||
StringPrototypeToLowerCase: String.prototype.toLowerCase, | ||
StringPrototypeToUpperCase: String.prototype.toUpperCase, | ||
StringPrototypeToLocaleLowerCase: String.prototype.toLocaleLowerCase, | ||
StringPrototypeToLocaleUpperCase: String.prototype.toLocaleUpperCase, | ||
StringPrototypeTrim: String.prototype.trim, | ||
//regex, | ||
RegExpPrototypeTest: RegExp.prototype.test, | ||
RegExpPrototypeExec: RegExp.prototype.exec, | ||
//function | ||
FunctionPrototypeToString: Function.prototype.toString, | ||
// misc | ||
JSONParse: JSON.parse, | ||
JSONStringify: JSON.stringify, | ||
UtilInspect: util_1.inspect, | ||
}; | ||
//# sourceMappingURL=primordials.js.map |
{ | ||
"name": "@contrast/common", | ||
"version": "1.25.0", | ||
"version": "1.26.0", | ||
"description": "Shared constants and utilities for all Contrast Agent modules", | ||
@@ -5,0 +5,0 @@ "license": "UNLICENSED", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1354
136653