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

@fanoutio/grip

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fanoutio/grip - npm Package Compare versions

Comparing version

to
2.1.1

/// <reference types="node" />
export default interface IWebSocketEvent {
type: string;
content: Buffer | Array<number> | string | null;
content: Buffer | number[] | string | null;
getType(): string;
getContent(): Buffer | Array<number> | string | null;
getContent(): Buffer | number[] | string | null;
}

@@ -5,6 +5,6 @@ /// <reference types="node" />

type: string;
content: Buffer | Array<number> | string | null;
constructor(type: string, content?: Buffer | Array<number> | string | null);
content: Buffer | number[] | string | null;
constructor(type: string, content?: Buffer | number[] | string | null);
getType(): string;
getContent(): string | Buffer | number[] | null;
}

@@ -535,4 +535,2 @@ import { Buffer } from 'buffer';

var objectToString = Object.prototype.toString;
// Determines whether the specified object is a function.
var functionObjectIdentifier = objectToString.call(function () { });
// Determines whether the specified object is a string.

@@ -539,0 +537,0 @@ var stringObjectIdentifier = objectToString.call('');

@@ -541,4 +541,2 @@ 'use strict';

var objectToString = Object.prototype.toString;
// Determines whether the specified object is a function.
var functionObjectIdentifier = objectToString.call(function () { });
// Determines whether the specified object is a string.

@@ -545,0 +543,0 @@ var stringObjectIdentifier = objectToString.call('');

/// <reference types="node" />
export declare function isFunction(obj: any): obj is Function;
export declare function isString(obj: any): obj is string;

@@ -4,0 +3,0 @@ export declare function toBuffer(input: any): Buffer;

{
"name": "@fanoutio/grip",
"version": "2.0.0",
"version": "2.1.1",
"author": "Fanout, Inc. <info@fanout.io>",

@@ -29,4 +29,4 @@ "description": "GRIP Interface Library",

"build-browser:build": "rollup -c rollup.browser.config.js",
"lint": "npm run lint:eslint",
"lint:eslint": "eslint --ext=.js src/* tests/*",
"lint": "npm run lint:tslint",
"lint:tslint": "tslint -c tslint.json 'src/**/*.ts' 'test/**/*.ts'",
"test": "TS_NODE_FILES=true TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha -r ts-node/register tests/*.ts"

@@ -49,3 +49,3 @@ },

"dependencies": {
"@fanoutio/pubcontrol": "^2.1.2",
"@fanoutio/pubcontrol": "^2.1.4",
"jspack": "0.0.4",

@@ -61,3 +61,2 @@ "jwt-simple": "^0.5.6"

"@types/mocha": "^7.0.2",
"eslint": "^6.8.0",
"mocha": "^7.1.1",

@@ -72,2 +71,3 @@ "rimraf": "^3.0.0",

"tslib": "^1.11.1",
"tslint": "^6.1.1",
"typescript": "^3.8.3"

@@ -74,0 +74,0 @@ },

@@ -18,3 +18,3 @@ import IExportedChannel from "./IExportedChannel";

export(): IExportedChannel {
const obj = <IExportedChannel>{name: this.name};
const obj = {name: this.name} as IExportedChannel;
if (this.prevId != null) {

@@ -21,0 +21,0 @@ obj.prevId = this.prevId;

@@ -36,3 +36,3 @@ import { Buffer } from 'buffer';

export() {
const obj = <IExportedResponse>{};
const obj = {} as IExportedResponse;
if (this.code != null) {

@@ -39,0 +39,0 @@ obj.code = this.code;

export default interface IWebSocketEvent {
type: string;
content: Buffer | Array<number> | string | null;
content: Buffer | number[] | string | null;
getType(): string;
getContent(): Buffer | Array<number> | string | null;
getContent(): Buffer | number[] | string | null;
}

@@ -8,5 +8,5 @@ import IWebSocketEvent from "./IWebSocketEvent";

type: string;
content: Buffer | Array<number> | string | null;
content: Buffer | number[] | string | null;
constructor(type: string, content: Buffer | Array<number> | string | null = null) {
constructor(type: string, content: Buffer | number[] | string | null = null) {
// Initialize with a specified event type and optional content information.

@@ -13,0 +13,0 @@ this.type = type;

@@ -188,3 +188,3 @@ import { Buffer } from 'buffer';

export function parseGripUri(uri: string) {
let parsedUri = url.parse(uri);
const parsedUri = url.parse(uri);
let iss: string | null = null;

@@ -228,3 +228,3 @@ let key: Buffer | string | null = null;

export function parseChannels(inChannels: Channels): Channel[] {
let channels = !Array.isArray(inChannels) ? [inChannels] : inChannels;
const channels = !Array.isArray(inChannels) ? [inChannels] : inChannels;
return channels.map(channel => isString(channel) ? new Channel(channel) : channel);

@@ -231,0 +231,0 @@ }

declare module 'jspack' {
export const jspack: {
Unpack(format: string, data: Array<number>, offset?: number): any;
Pack(format: string, data: any): Array<number> | false;
Unpack(format: string, data: number[], offset?: number): any;
Pack(format: string, data: any): number[] | false;
};
}

@@ -6,8 +6,2 @@ import { Buffer } from 'buffer';

// Determines whether the specified object is a function.
const functionObjectIdentifier = objectToString.call(function(){});
export function isFunction(obj: any): obj is Function {
return obj != null && objectToString.call(obj) === functionObjectIdentifier;
}
// Determines whether the specified object is a string.

@@ -14,0 +8,0 @@ const stringObjectIdentifier = objectToString.call('');

@@ -5,2 +5,3 @@ import assert from "assert";

const { Item, PubControlClient } = PubControl;
type PubControlClient = InstanceType<typeof PubControlClient>;

@@ -161,4 +162,3 @@ import GripPubControl from "../src/engine/GripPubControl";

let pc = new GripPubControl();
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -170,4 +170,3 @@ assert.equal(item, 'item');

});
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -198,4 +197,3 @@ assert.equal(item, 'item');

const pc = new GripPubControl();
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -217,4 +215,3 @@ assert.equal(JSON.stringify(item), JSON.stringify(new Item(

const pc = new GripPubControl();
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -228,4 +225,3 @@ assert.equal(JSON.stringify(item), JSON.stringify(new Item(

});
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -258,4 +254,3 @@ assert.equal(JSON.stringify(item), JSON.stringify(new Item(

const pc = new GripPubControl();
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -276,4 +271,3 @@ assert.equal(JSON.stringify(item), JSON.stringify(new Item(

const pc = new GripPubControl();
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -287,4 +281,3 @@ assert.equal(JSON.stringify(item), JSON.stringify(new Item(

});
// @ts-ignore
pc.addClient({
pc.addClient(<PubControlClient>{
publish: async function (channel: string, item: IItem) {

@@ -291,0 +284,0 @@ assert.equal(JSON.stringify(item), JSON.stringify(new Item(

import assert from 'assert';
import { isFunction, isString, toBuffer } from '../src/utilities';
import { isString, toBuffer } from '../src/utilities';
describe('utilities', function () {
describe('#isFunction', function () {
it('test case', function () {
assert(!(isFunction('hello')));
assert(isFunction(function(){}));
});
});
describe('#isString', function () {

@@ -12,0 +6,0 @@ it('test case', function () {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet