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

32 lines (27 loc) 956 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var backwards_utils_legacyNormalizeExpression = require('../utils/legacyNormalizeExpression.cjs'); require('../consts.cjs'); /** * Parse radius options * @private * @param {Array<string|number>|string|number} _radius The radius to parse * @return {string} radius transformation string */ function processRadius(_radius) { var radius = _radius; if (!radius) { return radius; } if (!Array.isArray(radius)) { radius = [radius]; } if (radius.length === 0 || radius.length > 4) { throw new Error("Radius array should contain between 1 and 4 values"); } if (radius.findIndex(function (x) { return x === null; }) >= 0) { throw new Error("Corner: Cannot be null"); } return radius.map(backwards_utils_legacyNormalizeExpression.legacyNormalizeExpression).join(':'); } exports.processRadius = processRadius;