
Company News
Meet the Socket Team at RSAC and BSidesSF 2026
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.
proxify-method
Advanced tools
ts example chainProxify js example chainProxify
// example with node-fetch and chai
const fetch = require('node-fetch');
const {chainProxify} = require('proxify-method');
const {expect} = require('chai');
function assertResponseBody(expectedBodyTextPart, {response}) {
expect(response).to.include(expectedBodyTextPart)
}
function assertResponseBodyStrictEqual(expectedBody, {response}) {
expect(response).to.equal(bodyTextPart)
}
class ControllerIterface {
constructor() {
// this two assertions will be available for every method in this class
chainProxify('assertBodyIncludes', assertResponseBody)
.chainProxify('strictAssertBody', assertResponseBodyStrictEqual)
.initChainModel(this);
}
getDataFromServerController() {
return fetch('http://someurl.that.returns.some.data')
.then(result => result.text())
// this {response: result} object will be second argument of the assert functions
.then(result => ({response: result}))
}
postDataFromServerController() {
return fetch('http://someurl.that.should_receive.some.data', {method: 'POST', body: 'string data'})
.then(result => result.text())
// this {response: result} object will be second argument of the assert functions
.then(result => ({response: result}))
}
}
async function test() {
const controller = new ControllerIterface();
const expectedGetBodyPart = 'some string';
const expectedGetBodyFull = 'some string full'
// can be done like TDD
const {response: responseTddExample} = await controller.getDataFromServerController();
expect(responseTddExample).to.include(expectedGetBodyPart);
expect(responseTddExample).to.equal(expectedGetBodyFull);
// ... usage of the response
const resultTdd = responseTddExample;
// can be done like BDD
const {response: responseBddExample} = await controller.getDataFromServerController()
.assertBodyIncludes(expectedGetBodyPart)
.strictAssertBody(expectedGetBodyFull)
// ... usage of the response
const resultBdd = responseBddExample;
}
import {proxify} from 'proxify-method';
const obj = {a: 2, b: 3, c: 4};
function isPropExists(prop, value, targetObj) {
expect(targetObj[prop]).toEqual(value);
}
const proxedObj = proxify(obj, {isPropExists: isPropExists});
const {a, b, c} = proxedObj
.isPropExists('a', 2)
.isPropExists('b', 3)
.isPropExists('c', 4);
expect(a).toEqual(obj.a);
expect(b).toEqual(obj.b);
expect(c).toEqual(obj.c);
expect(proxedObj).toDeepEqual(obj);
FAQs
Project for flexible extension of the existing functionality
The npm package proxify-method receives a total of 1 weekly downloads. As such, proxify-method popularity was classified as not popular.
We found that proxify-method demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.

Research
/Security News
OpenVSX releases of Aqua Trivy 1.8.12 and 1.8.13 contained injected natural-language prompts that abuse local AI coding agents for system inspection and potential data exfiltration.