New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rx-cache

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rx-cache

cache service for javascript

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

rx-cache

cache service for javascript

NPM JavaScript Style Guide

Install

npm install --save rx-cache

Example using rx-cache

var request = require("request");
const { Observable } = require("rxjs");
const { dispatch, buildPartnerRequest } = require("rx-cache");
const Background = {
  blue: "\x1b[44m%s\x1b[0m",
  yellow: "\x1b[33m%s\x1b[0m",
  red: "\x1b[41m"
};

const partnerRequest = (partner, params, notify) => {
  request.get(
    partner,
    {
      headers: {
        accept: "application/vnd.github.v3+json",
        "user-agent": "not v1.2.3" // v1.2.3 will be current version
      },
      params
    },
    (error, response, body) => {
      const { id, node_id: nodeId } = JSON.parse(body);

      notify({
        id,
        nodeId
      });
    }
  );
};

const partner1 = buildPartnerRequest(
  partnerRequest,
  "https://api.github.com/repos/ysfmag/advanced-react",
  {}
);

const partner2 = buildPartnerRequest(
  partnerRequest,
  "https://api.github.com/repos/ysfmag/amplify-js",
  {}
);

var partner3 = buildPartnerRequest(
  partnerRequest,
  "https://api.github.com/repos/ysfmag/rx-smart-cache",
  {}
);

dispatch(partner3).subscribe(e => {
  console.log("parnter3");
  console.log(Background.blue, JSON.stringify(e));
});

dispatch(partner1).subscribe(e => {
  console.log("parnter1");
  console.log(Background.blue, JSON.stringify(e));
});

dispatch(partner1).then(e => {
  console.log("parnter1  1 then function");
  console.log(Background.red, JSON.stringify(e));
});

dispatch(partner1).then(e => {
  console.log("parnter1  2 then function");
  console.log(Background.red, JSON.stringify(e));
});

dispatch(partner1).then(e => {
  console.log("parnter1 3 then function");
  console.log(Background.red, JSON.stringify(e));
});

dispatch(partner2).subscribe(e => {
  console.log(Background.blue, JSON.stringify(e));
});

License

MIT © youssef maghzaz

FAQs

Package last updated on 01 Nov 2018

Did you know?

Socket

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.

Install

Related posts