UNPKG

@cloudinary/url-gen

Version:

Cloudinary URL-Gen SDK ========================= [![Build Status](https://api.travis-ci.com/cloudinary/js-url-gen.svg?branch=master)](https://app.travis-ci.com/github/cloudinary/js-url-gen) ## About The Cloudinary URL-Gen SDK allows you to quickly and eas

41 lines (37 loc) 1.11 kB
'use strict'; var QualifierModel = require('./QualifierModel-0923d819.cjs'); /** * @memberOf Qualifiers.Source * @extends {QualifierModel} * @description An abstract class extended by all Source objects */ class BaseSource extends QualifierModel.QualifierModel { /** * @description Utility function to encode an asset publicID in an overlay * @protected * @example * encodeAssetPublicID('foo/bar'); // -> foo:bar */ encodeAssetPublicID(publicID) { return publicID.replace(/\//g, ':'); } /** * @description * Apply a transformation on the image source of the layer * @param {SDK.ImageTransformation} t An image transformation to apply to the layer * @returns {this} */ transformation(t) { this._qualifierModel.transformation = t.toJson(); this._transformation = t; return this; } /** * @description Returns the Transformation of the source * @return {SDK.Transformation} */ getTransformation() { return this._transformation; } } exports.BaseSource = BaseSource;