Files
react-native-devtools-frontend/node_modules/remark-stringify/lib/macro/ordered-items.js
T
Mathias Bynens 79e2cf0633 Add stylelint dependency
This also adds CC-BY-4.0 to the list of accepted licenses.

DISABLE_THIRD_PARTY_CHECK=update dependencies

Bug: chromium:1083142
Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-11 06:20:04 +00:00

44 lines
932 B
JavaScript

'use strict'
module.exports = orderedItems
var lineFeed = '\n'
var dot = '.'
var blank = lineFeed + lineFeed
// Visit ordered list items.
//
// Starts the list with
// `node.start` and increments each following list item
// bullet by one:
//
// 2. foo
// 3. bar
//
// In `incrementListMarker: false` mode, does not increment
// each marker and stays on `node.start`:
//
// 1. foo
// 1. bar
function orderedItems(node) {
var self = this
var fn = self.visitors.listItem
var increment = self.options.incrementListMarker
var values = []
var start = node.start
var children = node.children
var length = children.length
var index = -1
var bullet
start = start == null ? 1 : start
while (++index < length) {
bullet = (increment ? start + index : start) + dot
values[index] = fn.call(self, children[index], node, index, bullet)
}
return values.join(node.spread ? blank : lineFeed)
}