@frontmeans/doqry
Advanced tools
+59
-160
@@ -159,5 +159,2 @@ /** | ||
| /** | ||
| * @internal | ||
| */ | ||
| class DefaultNaming extends Naming { | ||
@@ -184,5 +181,2 @@ applyAlias(name, alias) { | ||
| const html__naming = ( /*#__PURE__*/new DefaultNaming()); | ||
| /** | ||
| * @internal | ||
| */ | ||
| class XmlNaming extends Naming { | ||
@@ -201,5 +195,2 @@ applyAlias(name, alias) { | ||
| const id__naming = ( /*#__PURE__*/new XmlNaming()); | ||
| /** | ||
| * @internal | ||
| */ | ||
| class CssNaming extends Naming { | ||
@@ -344,9 +335,5 @@ applyAlias(name, alias) { | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function compareStrings(first, second) { | ||
| return first < second ? -1 : first > second ? 1 : 0; | ||
| } | ||
| /** | ||
@@ -446,6 +433,2 @@ * Creates a namespace aliaser. | ||
| function iteratorOf(iterable) { | ||
| return iterable[Symbol.iterator](); | ||
| } | ||
| /** | ||
@@ -465,5 +448,2 @@ * Creates a push iterable implementation. | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function PushIterable$iterator() { | ||
@@ -473,22 +453,39 @@ return this[PushIterator__symbol](); | ||
| /** | ||
| * Iterates over elements of the given push iterable. | ||
| * | ||
| * Calls `accept` method for each iterated element until there are elements to iterate, or `accept` returned either | ||
| * `true` or `false`. | ||
| * | ||
| * Calling this function is the same as calling `!iterable[PushIterator__symbol](accept).isOver()`. | ||
| * | ||
| * @typeParam T - Iterated elements type. | ||
| * @param iterable - A push iterable to iterate elements of. | ||
| * @param accept - A function to push iterated elements to. Accepts iterated element as its only parameter. May return | ||
| * `true` to suspend iteration, or `false` to stop it. | ||
| * | ||
| * @returns `true` if there are more elements to iterate, or `false` otherwise. The former is possible only when | ||
| * iteration suspended, i.e. `accept` returned `true`. | ||
| */ | ||
| function pushIterated(iterable, accept) { | ||
| return !iterable[PushIterator__symbol](accept).isOver(); | ||
| function PushIterator$iterator() { | ||
| return this; | ||
| } | ||
| function PushIterator$next() { | ||
| for (;;) { | ||
| let result; | ||
| const tail = this[PushIterator__symbol](value => { | ||
| result = { value }; | ||
| return true; | ||
| }); | ||
| if (result) { | ||
| return result; | ||
| } | ||
| if (tail.isOver()) { | ||
| return { done: true }; | ||
| } | ||
| } | ||
| } | ||
| const PushIterator$empty = { | ||
| [Symbol.iterator]: PushIterator$iterator, | ||
| [PushIterator__symbol](_accept) { | ||
| return this; | ||
| }, | ||
| next: PushIterator$noNext, | ||
| isOver: PushIterator$over, | ||
| }; | ||
| function PushIterator$noNext() { | ||
| return { done: true }; | ||
| } | ||
| function PushIterator$dontIterate(_accept) { | ||
| // Do not iterate | ||
| } | ||
| function PushIterator$over() { | ||
| return true; | ||
| } | ||
| /** | ||
@@ -520,72 +517,2 @@ * Creates a push iterator implementation. | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function PushIterator$iterator() { | ||
| return this; | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function PushIterator$next() { | ||
| for (;;) { | ||
| let result; | ||
| const over = !pushIterated(this, value => { | ||
| result = { value }; | ||
| return true; | ||
| }); | ||
| if (result) { | ||
| return result; | ||
| } | ||
| if (over) { | ||
| return { done: true }; | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function PushIterator$noNext() { | ||
| return { done: true }; | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function PushIterator$dontIterate(_accept) { | ||
| /* do not iterate */ | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| const emptyPushIterator = { | ||
| [Symbol.iterator]: PushIterator$iterator, | ||
| [PushIterator__symbol](_accept) { | ||
| return this; | ||
| }, | ||
| next: () => ({ done: true }), | ||
| isOver: () => true, | ||
| }; | ||
| /** | ||
| * Iterates over the head elements of the given push iterable. | ||
| * | ||
| * Calls `accept` method for each iterated element until there are elements to iterate, or `accept` returned either | ||
| * `true` or `false`. | ||
| * | ||
| * Calling this function is the same as calling `iterable[PushIterator__symbol](accept)`. | ||
| * | ||
| * @typeParam T - Iterated elements type. | ||
| * @param iterable - A push iterable to iterate elements of. | ||
| * @param accept - A function to push iterated elements to. Accepts iterated element as its only parameter. May return | ||
| * `true` to suspend iteration, or `false` to stop it. | ||
| * | ||
| * @returns A push iterator instance representing the tail of the given iterable. This iterator can be used to continue | ||
| * iteration with, unless `accept` returned `false`. In the latter case the further iteration won't be possible. | ||
| */ | ||
| function pushHead(iterable, accept) { | ||
| return iterable[PushIterator__symbol](accept); | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function iterateOverIndexed(indexed, elementOf) { | ||
@@ -609,3 +536,3 @@ return accept => { | ||
| if (accept && !forNext(accept)) { | ||
| return emptyPushIterator; | ||
| return PushIterator$empty; | ||
| } | ||
@@ -642,11 +569,5 @@ let over = false; | ||
| /** | ||
| * @internal | ||
| */ | ||
| function arrayElementOf(array, index) { | ||
| return array[index]; | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function iterateOverArray(array) { | ||
@@ -656,5 +577,2 @@ return iterateOverIndexed(array, arrayElementOf); | ||
| /** | ||
| * @internal | ||
| */ | ||
| function toPushIterator(it, forNext) { | ||
@@ -690,5 +608,2 @@ let over = false; | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function rawIteratorPusher(it) { | ||
@@ -715,4 +630,2 @@ return accept => { | ||
| * | ||
| * In contrast to {@link pushHead} function, this one accepts any iterable instance. | ||
| * | ||
| * @typeParam T - Iterated elements type. | ||
@@ -726,38 +639,32 @@ * @param iterable - An iterable to iterate elements of. | ||
| */ | ||
| function itsHead(iterable, accept) { | ||
| function iterateIt(iterable, accept) { | ||
| if (isPushIterable(iterable)) { | ||
| return pushHead(iterable, accept); | ||
| return iterable[PushIterator__symbol](accept); | ||
| } | ||
| if (Array.isArray(iterable)) { | ||
| return arrayHead(iterable, accept); | ||
| return iterateIt$array(iterable, accept); | ||
| } | ||
| return rawIterableHead(iterable, accept); | ||
| return iterateIt$raw(iterable, accept); | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function arrayHead(array, accept) { | ||
| return array.length ? iterateOverArray(array)(accept) : emptyPushIterator; | ||
| function iterateIt$array(array, accept) { | ||
| return array.length ? iterateOverArray(array)(accept) : PushIterator$empty; | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function rawIterableHead(iterable, accept) { | ||
| const it = iteratorOf(iterable); | ||
| function iterateIt$raw(iterable, accept) { | ||
| const it = iterable[Symbol.iterator](); | ||
| if (isPushIterable(it)) { | ||
| return pushHead(it, accept); | ||
| return it[PushIterator__symbol](accept); | ||
| } | ||
| const forEach = rawIteratorPusher(it); | ||
| return forEach(accept) ? toPushIterator(it, forEach) : emptyPushIterator; | ||
| return forEach(accept) ? toPushIterator(it, forEach) : PushIterator$empty; | ||
| } | ||
| /** | ||
| * Returns a {@link PushIterator | push iterable iterator} without elements. | ||
| * Returns a {@link PushIterator push iterator} without elements. | ||
| * | ||
| * @typeParam T - Iterated elements type. | ||
| * | ||
| * @returns Empty push iterable and push iterator instance. | ||
| * @returns Empty push iterator instance. | ||
| */ | ||
| function overNone() { | ||
| return emptyPushIterator; | ||
| return PushIterator$empty; | ||
| } | ||
@@ -767,10 +674,9 @@ | ||
| return makePushIterable(accept => { | ||
| const forNext = isPushIterable(source) ? flatMapPusher(source, convert) : flatMapRawPusher(source, convert); | ||
| const forNext = isPushIterable(source) | ||
| ? flatMap$(source, convert) | ||
| : flatMap$raw(source, convert); | ||
| return accept && !forNext(accept) ? overNone() : makePushIterator(forNext); | ||
| }); | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function flatMapPusher(source, convert) { | ||
| function flatMap$(source, convert) { | ||
| let subs; | ||
@@ -781,3 +687,3 @@ let lastSrc = false; | ||
| while (!subs) { | ||
| const sourceTail = pushHead(source, src => { | ||
| const sourceTail = source[PushIterator__symbol](src => { | ||
| subs = convert(src); | ||
@@ -794,5 +700,4 @@ return true; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
| let status; | ||
| const subsTail = itsHead(subs, element => status = accept(element)); | ||
| const subsTail = iterateIt(subs, element => status = accept(element)); | ||
| if (subsTail.isOver()) { | ||
@@ -813,9 +718,6 @@ subs = undefined; | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function flatMapRawPusher(source, convert) { | ||
| const it = iteratorOf(source); | ||
| function flatMap$raw(source, convert) { | ||
| const it = source[Symbol.iterator](); | ||
| if (isPushIterable(it)) { | ||
| return flatMapPusher(it, convert); | ||
| return flatMap$(it, convert); | ||
| } | ||
@@ -834,3 +736,3 @@ let subs; | ||
| let status; | ||
| const subsTail = itsHead(subs, element => status = accept(element)); | ||
| const subsTail = iterateIt(subs, element => status = accept(element)); | ||
| subs = subsTail.isOver() ? undefined : subsTail; | ||
@@ -843,5 +745,2 @@ if (typeof status === 'boolean') { | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| function flatMapIt$defaultConverter(element) { | ||
@@ -848,0 +747,0 @@ return element; |
+22
-22
| { | ||
| "name": "@frontmeans/doqry", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "Document query notation for CSS selectors", | ||
@@ -22,26 +22,32 @@ "keywords": [ | ||
| "exports": "./dist/doqry.js", | ||
| "dependencies": { | ||
| "@frontmeans/httongue": "^2.3.0", | ||
| "@frontmeans/namespace-aliaser": "^2.6.2", | ||
| "@proc7ts/primitives": "^3.0.2", | ||
| "@proc7ts/push-iterator": "^3.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@jest/globals": "^27.0.3", | ||
| "@jest/globals": "^27.0.6", | ||
| "@rollup/plugin-node-resolve": "^13.0.0", | ||
| "@run-z/eslint-config": "^1.2.1", | ||
| "@typescript-eslint/eslint-plugin": "^4.25.0", | ||
| "@typescript-eslint/parser": "^4.25.0", | ||
| "eslint": "^7.27.0", | ||
| "@run-z/eslint-config": "^1.3.0", | ||
| "@typescript-eslint/eslint-plugin": "^4.28.3", | ||
| "@typescript-eslint/parser": "^4.28.3", | ||
| "eslint": "^7.30.0", | ||
| "eslint-plugin-jest": "^24.3.6", | ||
| "gh-pages": "^3.2.0", | ||
| "jest": "^27.0.3", | ||
| "jest-junit": "^12.1.0", | ||
| "jest-mock": "^27.0.3", | ||
| "gh-pages": "^3.2.3", | ||
| "jest": "^27.0.6", | ||
| "jest-junit": "^12.2.0", | ||
| "jest-mock": "^27.0.6", | ||
| "remark-cli": "^9.0.0", | ||
| "remark-preset-lint-recommended": "^5.0.0", | ||
| "rollup": "^2.50.4", | ||
| "rollup": "^2.53.2", | ||
| "rollup-plugin-flat-dts": "^1.2.2", | ||
| "rollup-plugin-sourcemaps": "^0.6.3", | ||
| "rollup-plugin-typescript2": "^0.30.0", | ||
| "run-z": "^1.8.0", | ||
| "run-z": "^1.9.1", | ||
| "shx": "^0.3.3", | ||
| "ts-jest": "^27.0.1", | ||
| "tslib": "^2.2.0", | ||
| "typedoc": "^0.20.36", | ||
| "typescript": "^4.3.2" | ||
| "ts-jest": "^27.0.3", | ||
| "tslib": "^2.3.0", | ||
| "typedoc": "^0.21.4", | ||
| "typescript": "^4.3.5" | ||
| }, | ||
@@ -59,9 +65,3 @@ "scripts": { | ||
| "z": "run-z +cmd:rollup,+cmd:typedoc,+cmd:eslint,+cmd:remark,+cmd:jest" | ||
| }, | ||
| "dependencies": { | ||
| "@frontmeans/httongue": "^2.3.0", | ||
| "@frontmeans/namespace-aliaser": "^2.5.0", | ||
| "@proc7ts/primitives": "^3.0.0", | ||
| "@proc7ts/push-iterator": "^2.6.0" | ||
| } | ||
| } |
| import nodeResolve from '@rollup/plugin-node-resolve'; | ||
| import { defineConfig } from 'rollup'; | ||
| import flatDts from 'rollup-plugin-flat-dts'; | ||
@@ -7,3 +8,3 @@ import sourcemaps from 'rollup-plugin-sourcemaps'; | ||
| export default { | ||
| export default defineConfig({ | ||
| input: { | ||
@@ -37,2 +38,2 @@ doqry: './src/index.ts', | ||
| }, | ||
| }; | ||
| }); |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
19
-13.64%146437
-3.79%1517
-6.07%- Removed
Updated