mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-24 19:27:58 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @name base64Validate
|
||||
* @summary Validates a base64 value.
|
||||
* @description
|
||||
* Validates that the supplied value is valid base64
|
||||
*/
|
||||
export declare const base64Validate: (value?: unknown, ipfsCompat?: boolean) => value is string;
|
||||
/**
|
||||
* @name isBase64
|
||||
* @description Checks if the input is in base64, returning true/false
|
||||
*/
|
||||
export declare const isBase64: (value?: unknown, ipfsCompat?: boolean) => value is string;
|
||||
/**
|
||||
* @name base64Decode
|
||||
* @summary Decodes a base64 value.
|
||||
* @description
|
||||
* From the provided input, decode the base64 and return the result as an `Uint8Array`.
|
||||
*/
|
||||
export declare const base64Decode: (value: string, ipfsCompat?: boolean) => Uint8Array;
|
||||
/**
|
||||
* @name base64Encode
|
||||
* @summary Creates a base64 value.
|
||||
* @description
|
||||
* From the provided input, create the base64 and return the result as a string.
|
||||
*/
|
||||
export declare const base64Encode: (value: import("@pezkuwi/util/types").U8aLike, ipfsCompat?: boolean) => string;
|
||||
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.base64Encode = exports.base64Decode = exports.isBase64 = exports.base64Validate = void 0;
|
||||
const base_1 = require("@scure/base");
|
||||
const helpers_js_1 = require("../base32/helpers.js");
|
||||
const config = {
|
||||
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
||||
coder: base_1.base64,
|
||||
type: 'base64',
|
||||
withPadding: true
|
||||
};
|
||||
/**
|
||||
* @name base64Validate
|
||||
* @summary Validates a base64 value.
|
||||
* @description
|
||||
* Validates that the supplied value is valid base64
|
||||
*/
|
||||
exports.base64Validate = (0, helpers_js_1.createValidate)(config);
|
||||
/**
|
||||
* @name isBase64
|
||||
* @description Checks if the input is in base64, returning true/false
|
||||
*/
|
||||
exports.isBase64 = (0, helpers_js_1.createIs)(exports.base64Validate);
|
||||
/**
|
||||
* @name base64Decode
|
||||
* @summary Decodes a base64 value.
|
||||
* @description
|
||||
* From the provided input, decode the base64 and return the result as an `Uint8Array`.
|
||||
*/
|
||||
exports.base64Decode = (0, helpers_js_1.createDecode)(config, exports.base64Validate);
|
||||
/**
|
||||
* @name base64Encode
|
||||
* @summary Creates a base64 value.
|
||||
* @description
|
||||
* From the provided input, create the base64 and return the result as a string.
|
||||
*/
|
||||
exports.base64Encode = (0, helpers_js_1.createEncode)(config);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @summary Encode and decode base64 values
|
||||
*/
|
||||
export { base64Decode, base64Encode, base64Validate, isBase64 } from './bs64.js';
|
||||
export { base64Pad } from './pad.js';
|
||||
export { base64Trim } from './trim.js';
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.base64Trim = exports.base64Pad = exports.isBase64 = exports.base64Validate = exports.base64Encode = exports.base64Decode = void 0;
|
||||
/**
|
||||
* @summary Encode and decode base64 values
|
||||
*/
|
||||
var bs64_js_1 = require("./bs64.js");
|
||||
Object.defineProperty(exports, "base64Decode", { enumerable: true, get: function () { return bs64_js_1.base64Decode; } });
|
||||
Object.defineProperty(exports, "base64Encode", { enumerable: true, get: function () { return bs64_js_1.base64Encode; } });
|
||||
Object.defineProperty(exports, "base64Validate", { enumerable: true, get: function () { return bs64_js_1.base64Validate; } });
|
||||
Object.defineProperty(exports, "isBase64", { enumerable: true, get: function () { return bs64_js_1.isBase64; } });
|
||||
var pad_js_1 = require("./pad.js");
|
||||
Object.defineProperty(exports, "base64Pad", { enumerable: true, get: function () { return pad_js_1.base64Pad; } });
|
||||
var trim_js_1 = require("./trim.js");
|
||||
Object.defineProperty(exports, "base64Trim", { enumerable: true, get: function () { return trim_js_1.base64Trim; } });
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @name base64Pad
|
||||
* @description Adds padding characters for correct length
|
||||
*/
|
||||
export declare function base64Pad(value: string): string;
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.base64Pad = base64Pad;
|
||||
/**
|
||||
* @name base64Pad
|
||||
* @description Adds padding characters for correct length
|
||||
*/
|
||||
function base64Pad(value) {
|
||||
return value.padEnd(value.length + (value.length % 4), '=');
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @name base64Trim
|
||||
* @description Trims padding characters
|
||||
*/
|
||||
export declare function base64Trim(value: string): string;
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.base64Trim = base64Trim;
|
||||
/**
|
||||
* @name base64Trim
|
||||
* @description Trims padding characters
|
||||
*/
|
||||
function base64Trim(value) {
|
||||
while (value.length && value.endsWith('=')) {
|
||||
value = value.slice(0, -1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
Reference in New Issue
Block a user