UNPKG

jobiqo-cl

Version:

[![CircleCI](https://circleci.com/gh/jobiqo/jobiqo-cl.svg?style=svg&circle-token=5a24efa5b8bbc4879276123e77d0d3f35ca7144c)](https://circleci.com/gh/jobiqo/jobiqo-cl)

33 lines (25 loc) 838 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var array = require('./array.js'); var tabSort = function tabSort(a, b) { var tabDiff = a.tabIndex - b.tabIndex; var indexDiff = a.index - b.index; if (tabDiff) { if (!a.tabIndex) return 1; if (!b.tabIndex) return -1; } return tabDiff || indexDiff; }; var orderByTabIndex = function orderByTabIndex(nodes, filterNegative, keepGuards) { return array.toArray(nodes).map(function (node, index) { return { node: node, index: index, tabIndex: keepGuards && node.tabIndex === -1 ? (node.dataset || {}).focusGuard ? 0 : -1 : node.tabIndex }; }).filter(function (data) { return !filterNegative || data.tabIndex >= 0; }).sort(tabSort); }; exports.orderByTabIndex = orderByTabIndex; exports.tabSort = tabSort;