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

curryfm

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

curryfm

Curried Node wrapper around the public GET methods of Lastfm API

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

:curry: curryfm

Curried Node wrapper around the public GET methods of Lastfm API. Uses Ramda, Babel and ES6.

Usage

npm install --save curryfm;

Then package exports a default curried function which takes 4 arguments:

  • api_key
  • resource - (one of 'user', 'track', 'artist', 'album' etc.)
  • method - (method called on resource e.g. 'getTopTracks', 'getInfo' etc.)
  • params

Check LastFM docs for info regarding these arguments. The function finally returns a Promise.

import curryfm from 'curryfm';
import readjson from 'read-json-sync';

const { api_key: API_KEY } = readjson("./config.json");

const client = curryfm(API_KEY);

const userClient = client("user");
const asrtistClient = client("artist");

const userTopTracks = userClient("getTopTracks");
const artistSimilar = asrtistClient("getSimilar");

const log = async (method, params) => {
  try {
    console.log(await method(params));
  } catch (err) {
    console.error(err);
  }
};

let params = {
 user: "sidjain26",
 period: "7day",
 limit: 10,
 format: "json"
};

log(userTopTracks, params);

params = {
  artist: "Drake",
  limit: 10,
  format: "json"
};

log(artistSimilar, params);

curryfm(API_KEY, "album", "search", {album: "Songs About Jane", limit: 10}).then((result) => {
  console.log(result);
}); // Alternatively you can call the function with all arguments

Keywords

FAQs

Package last updated on 26 Apr 2017

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

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