added all files to project

This commit is contained in:
2022-03-10 10:36:59 +01:00
parent 09dd957b33
commit 46a936d7de
25351 changed files with 3883356 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
// TypeScript Version: 3.5
import {Node, Parent} from 'unist'
import {Test} from 'unist-util-is'
export = findAllAfter
/**
* Unist utility to get all children of a parent after a node or index
*
* @param parent Parent to search in
* @param index or Node to start from
* @param test that Nodes must pass to be included
* @returns Array of found Nodes
*/
declare function findAllAfter<T extends Node>(
parent: Parent,
index: number | Node,
test?: Test<T> | Array<Test<T>>
): Node[]
+34
View File
@@ -0,0 +1,34 @@
'use strict'
var convert = require('unist-util-is/convert')
module.exports = findAllAfter
function findAllAfter(parent, index, test) {
var is = convert(test)
var results = []
if (!parent || !parent.type || !parent.children) {
throw new Error('Expected parent node')
}
if (typeof index === 'number') {
if (index < 0 || index === Infinity) {
throw new Error('Expected positive finite number as index')
}
} else {
index = parent.children.indexOf(index)
if (index < 0) {
throw new Error('Expected child node or index')
}
}
while (++index < parent.children.length) {
if (is(parent.children[index], index, parent)) {
results.push(parent.children[index])
}
}
return results
}
+22
View File
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+144
View File
@@ -0,0 +1,144 @@
{
"_args": [
[
"unist-util-find-all-after@3.0.2",
"/home/pi/Desktop/smartMirrorTestEnvironment/MagicMirror"
]
],
"_development": true,
"_from": "unist-util-find-all-after@3.0.2",
"_id": "unist-util-find-all-after@3.0.2",
"_inBundle": false,
"_integrity": "sha512-xaTC/AGZ0rIM2gM28YVRAFPIZpzbpDtU3dRmp7EXlNVA8ziQc4hY3H7BHXM1J49nEmiqc3svnqMReW+PGqbZKQ==",
"_location": "/unist-util-find-all-after",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "unist-util-find-all-after@3.0.2",
"name": "unist-util-find-all-after",
"escapedName": "unist-util-find-all-after",
"rawSpec": "3.0.2",
"saveSpec": null,
"fetchSpec": "3.0.2"
},
"_requiredBy": [
"/@stylelint/postcss-markdown"
],
"_resolved": "https://registry.npmjs.org/unist-util-find-all-after/-/unist-util-find-all-after-3.0.2.tgz",
"_spec": "3.0.2",
"_where": "/home/pi/Desktop/smartMirrorTestEnvironment/MagicMirror",
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/syntax-tree/unist-util-find-all-after/issues"
},
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
{
"name": "Lucas Brandstaetter",
"email": "lucas@brandstaetter.tech",
"url": "https://github.com/Roang-zero1"
}
],
"dependencies": {
"unist-util-is": "^4.0.0"
},
"description": "unist utility to find nodes after another node",
"devDependencies": {
"@types/tape": "^4.0.0",
"browserify": "^17.0.0",
"dtslint": "^4.0.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"remark": "^13.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"typescript": "^4.0.0",
"xo": "^0.34.0"
},
"files": [
"index.js",
"index.d.ts"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"homepage": "https://github.com/syntax-tree/unist-util-find-all-after#readme",
"keywords": [
"unist",
"unist-util",
"util",
"utility",
"tree",
"node",
"find",
"after"
],
"license": "MIT",
"name": "unist-util-find-all-after",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/syntax-tree/unist-util-find-all-after.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s unistUtilFindAllAfter -o unist-util-find-all-after.js",
"build-mangle": "browserify . -s unistUtilFindAllAfter -p tinyify -o unist-util-find-all-after.min.js",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test-types": "dtslint ."
},
"types": "index.d.ts",
"version": "3.0.2",
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"guard-for-in": "off",
"no-eq-null": "off"
},
"ignore": [
"unist-util-find-all-after.js",
"*.ts"
]
}
}
+160
View File
@@ -0,0 +1,160 @@
# unist-util-find-all-after
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[![Size][size-badge]][size]
[**unist**][unist] utility to find nodes after another node.
## Install
[npm][]:
```sh
npm install unist-util-find-all-after
```
## Use
```js
var u = require('unist-builder')
var findAllAfter = require('unist-util-find-all-after')
var tree = u('tree', [
u('leaf', 'leaf 1'),
u('node', [u('leaf', 'leaf 2'), u('leaf', 'leaf 3')]),
u('leaf', 'leaf 4'),
u('node', [u('leaf', 'leaf 5')]),
u('leaf', 'leaf 6'),
u('void'),
u('leaf', 'leaf 7')
])
console.log(findAllAfter(tree, 1, 'leaf'))
```
Yields:
```js
[
{type: 'leaf', value: 'leaf 4'},
{type: 'leaf', value: 'leaf 6'},
{type: 'leaf', value: 'leaf 7'}
]
```
## API
### `findAllAfter(parent, node|index[, test])`
Find all children after `index` (or `node`) in `parent` that pass `test` (when
given).
###### Parameters
* `parent` ([`Node`][node]) — [Parent][] node
* `node` ([`Node`][node]) — [Child][] of `parent`
* `index` (`number`, optional) — [Index][] in `parent`
* `test` (`Function`, `string`, `Object`, `Array`, optional)
— See [`unist-util-is`][is]
###### Returns
[`Array.<Node>`][node] — [Child][]ren of `parent` passing `test`.
## Related
* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit)
— Recursively walk over nodes
* [`unist-util-visit-parents`](https://github.com/syntax-tree/unist-util-visit-parents)
— Like `visit`, but with a stack of parents
* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)
— Create a new tree with all nodes that pass a test
* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map)
— Create a new tree with all nodes mapped by a given function
* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap)
— Create a new tree by mapping (to an array) with the given function
* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after)
— Find a node after another node
* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before)
— Find a node before another node
* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after)
— Find all nodes after another node
* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before)
— Find all nodes before another node
* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between)
— Find all nodes between two nodes
* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)
— Remove nodes from a tree that pass a test
* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select)
— Select nodes with CSS-like selectors
## Contribute
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-find-all-after.svg
[build]: https://travis-ci.org/syntax-tree/unist-util-find-all-after
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-find-all-after.svg
[coverage]: https://codecov.io/github/syntax-tree/unist-util-find-all-after
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-find-all-after.svg
[downloads]: https://www.npmjs.com/package/unist-util-find-all-after
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-find-all-after.svg
[size]: https://bundlephobia.com/result?p=unist-util-find-all-after
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://github.com/syntax-tree/unist/discussions
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[unist]: https://github.com/syntax-tree/unist
[node]: https://github.com/syntax-tree/unist#node
[parent]: https://github.com/syntax-tree/unist#parent-1
[child]: https://github.com/syntax-tree/unist#child
[index]: https://github.com/syntax-tree/unist#index
[is]: https://github.com/syntax-tree/unist-util-is
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md