Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@goldfishjs/bridge

Package Overview
Dependencies
Maintainers
2
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goldfishjs/bridge - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

68

lib/bridge.js

@@ -0,21 +1,30 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
export default {
// my.xxx
call: async function call(api, params) {
return new Promise((resolve, reject) => {
if (typeof my[api] === 'function') {
my[api]({
...params,
success(res) {
resolve(res);
},
fail: reject,
});
}
call: function call(api, params) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
if (typeof my[api] === 'function') {
my[api](Object.assign(Object.assign({}, params), { success(res) {
resolve(res);
}, fail: reject }));
}
});
});
},
// my.call('xxx')
mycall: async function mycall(api, params) {
return new Promise((resolve) => {
my.call(api, params, (result) => {
resolve(result);
mycall: function mycall(api, params) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve) => {
my.call(api, params, (result) => {
resolve(result);
});
});

@@ -25,19 +34,18 @@ });

// my.ap.xxx
ap: async function ap(api, params) {
return new Promise((resolve, reject) => {
if (typeof my[api] ===
'function' &&
params) {
my[api]({
...params,
success(res) {
resolve(res);
},
fail() {
reject();
},
});
}
ap: function ap(api, params) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
if (typeof my[api] ===
'function' &&
params) {
my[api](Object.assign(Object.assign({}, params), { success(res) {
resolve(res);
},
fail() {
reject();
} }));
}
});
});
},
};

@@ -0,1 +1,10 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
function mockServer(host, api, params) {

@@ -6,5 +15,3 @@ return new Promise((resolve, reject) => {

method: 'GET',
data: {
...params,
},
data: Object.assign({}, params),
success(result) {

@@ -19,13 +26,19 @@ resolve(result);

// my.xxx
call: async function call(host, api, params) {
return mockServer(host, api, params);
call: function call(host, api, params) {
return __awaiter(this, void 0, void 0, function* () {
return mockServer(host, api, params);
});
},
// my.call('xxx')
mycall: async function mycall(host, api, params) {
return mockServer(host, api, params);
mycall: function mycall(host, api, params) {
return __awaiter(this, void 0, void 0, function* () {
return mockServer(host, api, params);
});
},
// my.ap.xxx
ap: async function ap(host, api, params) {
return mockServer(host, api, params);
ap: function ap(host, api, params) {
return __awaiter(this, void 0, void 0, function* () {
return mockServer(host, api, params);
});
},
};
{
"name": "@goldfishjs/bridge",
"version": "0.0.2",
"version": "0.0.3",
"description": "goldfish-bridge",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -13,4 +13,4 @@ {

"esModuleInterop": true,
"module": "esnext",
"target": "esnext",
"module": "es6",
"target": "es6",
"outDir": "../lib",

@@ -17,0 +17,0 @@ "declaration": true,

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