UNPKG

681 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.toPopperPlacement = toPopperPlacement;
7exports.parsePopperOffset = parsePopperOffset;
8
9/*
10Copyright (c) 2018-2020 Uber Technologies, Inc.
11
12This source code is licensed under the MIT license found in the
13LICENSE file in the root directory of this source tree.
14*/
15function toPopperPlacement(placement) {
16 return placement.replace(/(Top|Left)$/, '-start').replace(/(Right|Bottom)$/, '-end');
17}
18/**
19 * Takes the offset passed from popper.js and normalizes it
20 */
21
22
23function parsePopperOffset(offset) {
24 return {
25 top: Math.floor(offset.top || 0),
26 left: Math.floor(offset.left || 0)
27 };
28}
\No newline at end of file