New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@trayio/commons

Package Overview
Dependencies
Maintainers
0
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trayio/commons - npm Package Compare versions

Comparing version 4.71.0 to 4.72.0

dist/codec/PartialRedactionCodec.d.ts

1

dist/base64/Base64.d.ts

@@ -13,2 +13,3 @@ import * as t from 'io-ts';

fromBase64String: (value: string) => E.Either<Error, Base64>;
fromStringToBase64String: (value: string) => string;
encodeBinary: (value: ArrayBuffer) => Base64;

@@ -15,0 +16,0 @@ decodeBinary: (value: Base64) => ArrayBuffer;

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

fromBase64String: (value) => base64TypeCodec.decode(value),
fromStringToBase64String: (value) => Buffer.from(value).toString('base64'),
encodeBinary: (value) => {

@@ -43,0 +44,0 @@ const base64data = Buffer.from(value).toString('base64');

@@ -38,2 +38,7 @@ "use strict";

});
test('it should encode a string to base64', () => {
const testValue = 'this is a test string.';
const base64 = Base64_1.Base64.fromStringToBase64String(testValue);
expect(base64).toStrictEqual('dGhpcyBpcyBhIHRlc3Qgc3RyaW5nLg==');
});
test('should encode and decode an ArrayBuffer', () => {

@@ -40,0 +45,0 @@ const testValue = { test: 'value' };

/// <reference types="node" />
/// <reference types="node" />
import { Readable } from 'stream';

@@ -7,4 +8,5 @@ import * as TE from 'fp-ts/TaskEither';

arrayBufferToReadable: (arrayBuffer: ArrayBuffer) => Readable;
bufferToArrayBuffer: (buffer: Buffer) => ArrayBuffer;
}
export declare const BufferExtensions: BufferExtensionsInterface;
//# sourceMappingURL=BufferExtensions.d.ts.map

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

arrayBufferToReadable: (arrayBuffer) => stream_1.Readable.from(Buffer.from(arrayBuffer)),
bufferToArrayBuffer: (buffer) => buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength),
};

@@ -62,2 +62,7 @@ "use strict";

});
it('should encode a buffer to an array buffer', () => {
const buffer = Buffer.from('test');
const arrayBuffer = BufferExtensions_1.BufferExtensions.bufferToArrayBuffer(buffer);
expect(arrayBuffer).toEqual(new util_1.TextEncoder().encode('test').buffer);
});
});
import * as TE from 'fp-ts/TaskEither';
import * as E from 'fp-ts/Either';
import * as O from 'fp-ts/Option';
import * as t from 'io-ts';

@@ -13,2 +14,7 @@ import { Codec } from '../codec/Codec';

removeNullValues: (value: DynamicObject) => DynamicObject;
getTypedProperty: <T>(dynamicObject: DynamicObject, name: string, codec: Codec<T>) => O.Option<T>;
getObjectProperty: (dynamicObject: DynamicObject, name: string) => O.Option<DynamicObject>;
getStringProperty: (dynamicObject: DynamicObject, name: string) => O.Option<string>;
getNumberProperty: (dynamicObject: DynamicObject, name: string) => O.Option<number>;
getBooleanProperty: (dynamicObject: DynamicObject, name: string) => O.Option<boolean>;
}

@@ -21,2 +27,5 @@ export declare const DynamicObject: DynamicObjectInterface;

safeCast: <T>(dynamicType: DynamicType, codec: Codec<T>) => E.Either<Error, T>;
getStringProperty: (dynamicObject: DynamicObject, name: string) => O.Option<string>;
getNumberProperty: (dynamicObject: DynamicObject, name: string) => O.Option<number>;
getBooleanProperty: (dynamicObject: DynamicObject, name: string) => O.Option<boolean>;
}

@@ -23,0 +32,0 @@ export declare const DynamicType: DynamicTypeInterface;

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

const E = __importStar(require("fp-ts/Either"));
const O = __importStar(require("fp-ts/Option"));
const function_1 = require("fp-ts/function");

@@ -38,2 +39,3 @@ const t = __importStar(require("io-ts"));

const RemoveNullValuesCodec_1 = require("../codec/RemoveNullValuesCodec");
const TypeCodec_1 = require("../codec/TypeCodec");
const serializer = new JsonSerialization_1.JsonSerialization();

@@ -44,2 +46,7 @@ const testRemoveNullValuesCodec = RemoveNullValuesCodec_1.RemoveNullValuesCodec.instance;

removeNullValues: (value) => testRemoveNullValuesCodec.encode(value),
getTypedProperty: (dynamicObject, name, codec) => (0, function_1.pipe)((0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => O.fromEither(exports.DynamicType.safeCast(property, codec))))),
getObjectProperty: (dynamicObject, name) => exports.DynamicObject.getTypedProperty(dynamicObject, name, TypeCodec_1.TypeCodec.fromDescriptor(exports.dynamicObjectTypeDescriptor)),
getStringProperty: (dynamicObject, name) => (0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => typeof property === 'string' ? O.some(property) : O.none)),
getNumberProperty: (dynamicObject, name) => (0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => typeof property === 'number' ? O.some(property) : O.none)),
getBooleanProperty: (dynamicObject, name) => (0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => typeof property === 'boolean' ? O.some(property) : O.none)),
};

@@ -51,2 +58,5 @@ exports.DynamicType = {

safeCast: (dynamicType, codec) => codec.decode(dynamicType),
getStringProperty: (dynamicObject, name) => (0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => typeof property === 'string' ? O.some(property) : O.none)),
getNumberProperty: (dynamicObject, name) => (0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => typeof property === 'number' ? O.some(property) : O.none)),
getBooleanProperty: (dynamicObject, name) => (0, function_1.pipe)(O.fromNullable(dynamicObject[name]), O.chain((property) => typeof property === 'boolean' ? O.some(property) : O.none)),
};

@@ -53,0 +63,0 @@ exports.dynamicTypeDescriptor = t.recursion('DynamicType', () => t.union([

2

package.json
{
"name": "@trayio/commons",
"version": "4.71.0",
"version": "4.72.0",
"description": "Extensions to the standard/core libraries and basic features",

@@ -5,0 +5,0 @@ "exports": {

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