0.6.0 • Published 5 years ago

@justeat/cloudinary v0.6.0

Weekly downloads
39
License
Apache-2.0
Repository
github
Last release
5 years ago

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' });
ValueDescription
prod(default) Production
stagingStaging
testTest

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

0.6.0

5 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago