@justeat/cloudinary

0.6.0 • Public • Published

Cloudinary

Javascript library for working with Just Eat's Cloudinary service

Installation

npm install @justeat/cloudinary
yarn add @justeat/cloudinary

Usage

Create an instance

import Cloudinary from '@justeat/cloudinary';

const cloudinary = Cloudinary({
  tenant: 'uk',
  env: 'prod'
});

Tenant

  • Set the instance's tenant
  • Defaults to uk for undefined value
const cloudinary = Cloudinary({ tenant: 'uk' });

Environment

  • Set the instance's environment
  • Using a non-configured environment throws an INVALID_ENV error
const cloudinary = Cloudinary({ env: 'prod' });
Value Description
prod (default) Production
staging Staging
test Test

Methods

Please check the source documentation for more detail on how to use the below methods

restaurant: Returns the cloudinary path of a restaurant image

const restaurantId = 2782084;
const opts = {
  cuisine: 'thai',
  quality: 'auto'
};
const url = cloudinary.restaurant(restaurantId, opts);

dishes: Returns the cloudinary path of a restaurant dish image

const restaurantId = 2782084;
const dishImage = 'assorted-meal.jpg'
const opts = {
  quality: 'auto'
};
const url = cloudinary.dishes(restaurantId, dishImage, opts);

url: Returns cloudinary url of restaurant image

const resourcePath = '/path/to/resource.jpg';
const params = {
  height: 100,
  width: 100
};
const url = cloudinary.url(resourcePath, params);

Development and Testing

Build: npm run build

Lint: npm run lint

Release: npm run release

Single run test: jest

Continuous test: jest --watchAll

Readme

Keywords

Package Sidebar

Install

npm i @justeat/cloudinary

Weekly Downloads

0

Version

0.6.0

License

Apache-2.0

Unpacked Size

23.7 kB

Total Files

7

Last publish

Collaborators

  • ilia.chikmarev
  • fidel.montesino
  • anastasiia.horban
  • raouf.sawehli
  • mmakwe-onyeka
  • gregory.palaci
  • arielfdr
  • dawidchar
  • roberto.santana
  • lizzie.turney
  • davidpn.11
  • dandel10n
  • mwh1989
  • kevinrodrigues
  • fozzie-bot
  • ashleynolan
  • simonsje
  • xander-marjoram
  • sergii.semenkiv
  • thomaswilliammcclean
  • benrwhite
  • robertellison
  • zlatin.ivanov
  • joshuang2332
  • oliversweb
  • andymayje
  • jamieomaguire
  • adammorr
  • lsphillips