UNPKG

flipper-plugin

Version:

Flipper Desktop plugin SDK and components

20 lines 682 B
"use strict"; /** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ Object.defineProperty(exports, "__esModule", { value: true }); exports.calculatePercentage = exports.isPercentage = void 0; function isPercentage(width) { return typeof width === 'string' && width[width.length - 1] === '%'; } exports.isPercentage = isPercentage; function calculatePercentage(parentWidth, selfWidth) { return `${(100 / parentWidth) * selfWidth}%`; } exports.calculatePercentage = calculatePercentage; //# sourceMappingURL=widthUtils.js.map