Socket
Socket
Sign inDemoInstall

@effect/data

Package Overview
Dependencies
0
Maintainers
3
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.18.3 to 0.18.4

41

Encoding.d.ts

@@ -10,5 +10,5 @@ /**

*/
import type * as Either from "@effect/data/Either";
import * as Either from "@effect/data/Either";
/**
* Encodes a Uint8Array into a base64 (RFC4648) string.
* Encodes the given value into a base64 (RFC4648) `string`.
*

@@ -18,5 +18,5 @@ * @category encoding

*/
export declare const encodeBase64: (bytes: Uint8Array) => string;
export declare const encodeBase64: (input: Uint8Array | string) => string;
/**
* Decodes a base64 (RFC4648) encoded string.
* Decodes a base64 (RFC4648) encoded `string` into a `Uint8Array`.
*

@@ -28,10 +28,17 @@ * @category decoding

/**
* Encodes a Uint8Array into a base64 (URL) string.
* Decodes a base64 (RFC4648) encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
*/
export declare const decodeBase64String: (str: string) => Either.Either<DecodeException, string>;
/**
* Encodes the given value into a base64 (URL) `string`.
*
* @category encoding
* @since 1.0.0
*/
export declare const encodeBase64Url: (bytes: Uint8Array) => string;
export declare const encodeBase64Url: (input: Uint8Array | string) => string;
/**
* Decodes a base64 (URL) encoded string.
* Decodes a base64 (URL) encoded `string` into a `Uint8Array`.
*

@@ -43,10 +50,17 @@ * @category decoding

/**
* Encodes a Uint8Array into a hex string.
* Decodes a base64 (URL) encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
*/
export declare const decodeBase64UrlString: (str: string) => Either.Either<DecodeException, string>;
/**
* Encodes the given value into a hex `string`.
*
* @category encoding
* @since 1.0.0
*/
export declare const encodeHex: (bytes: Uint8Array) => string;
export declare const encodeHex: (input: Uint8Array | string) => string;
/**
* Decodes a hex encoded string.
* Decodes a hex encoded `string` into a `Uint8Array`.
*

@@ -58,3 +72,10 @@ * @category decoding

/**
* Decodes a hex encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
*/
export declare const decodeHexString: (str: string) => Either.Either<DecodeException, string>;
/**
* @since 1.0.0
* @category symbols

@@ -61,0 +82,0 @@ */

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

});
exports.isDecodeException = exports.encodeHex = exports.encodeBase64Url = exports.encodeBase64 = exports.decodeHex = exports.decodeBase64Url = exports.decodeBase64 = exports.DecodeExceptionTypeId = exports.DecodeException = void 0;
exports.isDecodeException = exports.encodeHex = exports.encodeBase64Url = exports.encodeBase64 = exports.decodeHexString = exports.decodeHex = exports.decodeBase64UrlString = exports.decodeBase64Url = exports.decodeBase64String = exports.decodeBase64 = exports.DecodeExceptionTypeId = exports.DecodeException = void 0;
var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either"));
var Base64 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/internal/Encoding/Base64"));
var Base64Url = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/internal/Encoding/Base64Url"));
var common = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/internal/Encoding/Common"));
var Common = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/internal/Encoding/Common"));
var Hex = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/internal/Encoding/Hex"));

@@ -15,10 +16,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

/**
* Encodes a Uint8Array into a base64 (RFC4648) string.
* This module provides encoding & decoding functionality for:
*
* - base64 (RFC4648)
* - base64 (URL)
* - hex
*
* @since 1.0.0
*/
/**
* Encodes the given value into a base64 (RFC4648) `string`.
*
* @category encoding
* @since 1.0.0
*/
const encodeBase64 = Base64.encode;
const encodeBase64 = input => typeof input === "string" ? Base64.encode(Common.encoder.encode(input)) : Base64.encode(input);
/**
* Decodes a base64 (RFC4648) encoded string.
* Decodes a base64 (RFC4648) encoded `string` into a `Uint8Array`.
*

@@ -31,12 +42,20 @@ * @category decoding

/**
* Encodes a Uint8Array into a base64 (URL) string.
* Decodes a base64 (RFC4648) encoded `string` into a UTF-8 `string`.
*
* @category encoding
* @category decoding
* @since 1.0.0
*/
exports.decodeBase64 = decodeBase64;
const encodeBase64Url = Base64Url.encode;
const decodeBase64String = str => Either.map(decodeBase64(str), _ => Common.decoder.decode(_));
/**
* Decodes a base64 (URL) encoded string.
* Encodes the given value into a base64 (URL) `string`.
*
* @category encoding
* @since 1.0.0
*/
exports.decodeBase64String = decodeBase64String;
const encodeBase64Url = input => typeof input === "string" ? Base64Url.encode(Common.encoder.encode(input)) : Base64Url.encode(input);
/**
* Decodes a base64 (URL) encoded `string` into a `Uint8Array`.
*
* @category decoding

@@ -48,12 +67,20 @@ * @since 1.0.0

/**
* Encodes a Uint8Array into a hex string.
* Decodes a base64 (URL) encoded `string` into a UTF-8 `string`.
*
* @category encoding
* @category decoding
* @since 1.0.0
*/
exports.decodeBase64Url = decodeBase64Url;
const encodeHex = Hex.encode;
const decodeBase64UrlString = str => Either.map(decodeBase64Url(str), _ => Common.decoder.decode(_));
/**
* Decodes a hex encoded string.
* Encodes the given value into a hex `string`.
*
* @category encoding
* @since 1.0.0
*/
exports.decodeBase64UrlString = decodeBase64UrlString;
const encodeHex = input => typeof input === "string" ? Hex.encode(Common.encoder.encode(input)) : Hex.encode(input);
/**
* Decodes a hex encoded `string` into a `Uint8Array`.
*
* @category decoding

@@ -65,8 +92,16 @@ * @since 1.0.0

/**
* Decodes a hex encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
* @category symbols
*/
exports.decodeHex = decodeHex;
const DecodeExceptionTypeId = common.DecodeExceptionTypeId;
const decodeHexString = str => Either.map(decodeHex(str), _ => Common.decoder.decode(_));
/**
* @since 1.0.0
* @category symbols
*/
exports.decodeHexString = decodeHexString;
const DecodeExceptionTypeId = Common.DecodeExceptionTypeId;
/**
* Creates a checked exception which occurs when decoding fails.

@@ -78,3 +113,3 @@ *

exports.DecodeExceptionTypeId = DecodeExceptionTypeId;
const DecodeException = common.DecodeException;
const DecodeException = Common.DecodeException;
/**

@@ -87,4 +122,4 @@ * Returns `true` if the specified value is an `DecodeException`, `false` otherwise.

exports.DecodeException = DecodeException;
const isDecodeException = common.isDecodeException;
const isDecodeException = Common.isDecodeException;
exports.isDecodeException = isDecodeException;
//# sourceMappingURL=Encoding.js.map

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

export {};
/// <reference types="node" />
/** @interal */
export declare const encoder: import("util").TextEncoder;
/** @interal */
export declare const decoder: import("util").TextDecoder;
//# sourceMappingURL=Common.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.isDecodeException = exports.DecodeExceptionTypeId = exports.DecodeException = void 0;
exports.isDecodeException = exports.encoder = exports.decoder = exports.DecodeExceptionTypeId = exports.DecodeException = void 0;
/** @internal */

@@ -21,3 +21,9 @@ const DecodeExceptionTypeId = /*#__PURE__*/Symbol.for("@effect/data/Encoding/errors/Decode");

const isDecodeException = u => typeof u === "object" && u != null && DecodeExceptionTypeId in u;
/** @interal */
exports.isDecodeException = isDecodeException;
const encoder = /*#__PURE__*/new TextEncoder();
/** @interal */
exports.encoder = encoder;
const decoder = /*#__PURE__*/new TextDecoder();
exports.decoder = decoder;
//# sourceMappingURL=Common.js.map
{
"name": "@effect/data",
"version": "0.18.3",
"version": "0.18.4",
"description": "Functional programming in TypeScript",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -10,10 +10,10 @@ /**

*/
import type * as Either from "@effect/data/Either"
import * as Either from "@effect/data/Either"
import * as Base64 from "@effect/data/internal/Encoding/Base64"
import * as Base64Url from "@effect/data/internal/Encoding/Base64Url"
import * as common from "@effect/data/internal/Encoding/Common"
import * as Common from "@effect/data/internal/Encoding/Common"
import * as Hex from "@effect/data/internal/Encoding/Hex"
/**
* Encodes a Uint8Array into a base64 (RFC4648) string.
* Encodes the given value into a base64 (RFC4648) `string`.
*

@@ -23,6 +23,7 @@ * @category encoding

*/
export const encodeBase64: (bytes: Uint8Array) => string = Base64.encode
export const encodeBase64: (input: Uint8Array | string) => string = (input) =>
typeof input === "string" ? Base64.encode(Common.encoder.encode(input)) : Base64.encode(input)
/**
* Decodes a base64 (RFC4648) encoded string.
* Decodes a base64 (RFC4648) encoded `string` into a `Uint8Array`.
*

@@ -35,11 +36,20 @@ * @category decoding

/**
* Encodes a Uint8Array into a base64 (URL) string.
* Decodes a base64 (RFC4648) encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
*/
export const decodeBase64String = (str: string) => Either.map(decodeBase64(str), (_) => Common.decoder.decode(_))
/**
* Encodes the given value into a base64 (URL) `string`.
*
* @category encoding
* @since 1.0.0
*/
export const encodeBase64Url: (bytes: Uint8Array) => string = Base64Url.encode
export const encodeBase64Url: (input: Uint8Array | string) => string = (input) =>
typeof input === "string" ? Base64Url.encode(Common.encoder.encode(input)) : Base64Url.encode(input)
/**
* Decodes a base64 (URL) encoded string.
* Decodes a base64 (URL) encoded `string` into a `Uint8Array`.
*

@@ -52,11 +62,20 @@ * @category decoding

/**
* Encodes a Uint8Array into a hex string.
* Decodes a base64 (URL) encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
*/
export const decodeBase64UrlString = (str: string) => Either.map(decodeBase64Url(str), (_) => Common.decoder.decode(_))
/**
* Encodes the given value into a hex `string`.
*
* @category encoding
* @since 1.0.0
*/
export const encodeHex: (bytes: Uint8Array) => string = Hex.encode
export const encodeHex: (input: Uint8Array | string) => string = (input) =>
typeof input === "string" ? Hex.encode(Common.encoder.encode(input)) : Hex.encode(input)
/**
* Decodes a hex encoded string.
* Decodes a hex encoded `string` into a `Uint8Array`.
*

@@ -69,6 +88,14 @@ * @category decoding

/**
* Decodes a hex encoded `string` into a UTF-8 `string`.
*
* @category decoding
* @since 1.0.0
*/
export const decodeHexString = (str: string) => Either.map(decodeHex(str), (_) => Common.decoder.decode(_))
/**
* @since 1.0.0
* @category symbols
*/
export const DecodeExceptionTypeId: unique symbol = common.DecodeExceptionTypeId
export const DecodeExceptionTypeId: unique symbol = Common.DecodeExceptionTypeId

@@ -100,3 +127,3 @@ /**

*/
export const DecodeException: (input: string, message?: string) => DecodeException = common.DecodeException
export const DecodeException: (input: string, message?: string) => DecodeException = Common.DecodeException

@@ -109,2 +136,2 @@ /**

*/
export const isDecodeException: (u: unknown) => u is DecodeException = common.isDecodeException
export const isDecodeException: (u: unknown) => u is DecodeException = Common.isDecodeException

@@ -19,1 +19,7 @@ import type * as Encoding from "@effect/data/Encoding"

typeof u === "object" && u != null && DecodeExceptionTypeId in u
/** @interal */
export const encoder = new TextEncoder()
/** @interal */
export const decoder = new TextDecoder()

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc