# lassy-xpath

> [![DOI](https://zenodo.org/badge/129089800.svg)](https://zenodo.org/doi/10.5281/zenodo.10426257) [![Build Status](https://github.com/CentreForDigitalHumanities/lassy-xpath/workflows/tests/badge.svg)](https://github.com/CentreForDigitalHumanities/lassy-xpa

Latest version **0.15.1** (published 2023-02-21) · 0 weekly downloads

## Install

```sh
npm install lassy-xpath
pnpm add lassy-xpath
yarn add lassy-xpath
bun add lassy-xpath
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.15.1 |
| Published | 2023-02-21 |
| First published | 2018-04-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dhl-uu-bis, jgonggrijp |

## Links

- npm: https://www.npmjs.com/package/lassy-xpath
- npm.io page: https://npm.io/package/lassy-xpath

## Recent versions

- 0.15.1 (latest) — 2023-02-21
- 0.15.0 — 2023-02-09
- 0.12.1 — 2023-02-09
- 0.12.0 — 2021-06-25
- 0.4.3 — 2020-05-01
- 0.4.2 — 2020-04-02
- 0.4.0 — 2019-04-29
- 0.3.11 — 2018-12-10
- 0.3.10 — 2018-12-07
- 0.3.9 — 2018-12-07
- 0.3.8 — 2018-11-27
- 0.3.7 — 2018-11-27
- 0.3.6 — 2018-11-23
- 0.3.5 — 2018-11-23
- 0.3.4 — 2018-10-02
- … 23 more at https://npm.io/package/lassy-xpath/versions

## README

[![Build Status](https://github.com/UUDigitalHumanitieslab/lassy-xpath/workflows/tests/badge.svg)](https://github.com/UUDigitalHumanitieslab/lassy-xpath/actions)
[![npm version](https://badge.fury.io/js/lassy-xpath.svg)](https://badge.fury.io/js/lassy-xpath)

## LASSY XPath

Module for working with XPath queries on [LASSY XML](https://www.let.rug.nl/vannoord/Lassy/) files. It includes a graphical editor including auto completion, macros and validation based on [Ace](https://ace.c9.io/), a parser and validator based on [ts-xpath](https://github.com/UUDigitalHumanitieslab/ts-xpath) and an "extractinator" for determining XPaths to get each node from the returned tree separately. It also has a "reconstructor" to create an XML structure representing the query tree. The functionality can be used as an Angular module.

## Compatibility

- v0.15.x is for Angular 15
- v0.12.x is for Angular 12
- v0.4.3 and down should work with Angular 6 and JQuery

## Angular

```bash
npm install lassy-xpath
```

Import the module:

```typescript
import { LassyXPathModule } from 'lassy-xpath';

@NgModule({
    imports: [LassyXPathModule]
})
export class AppModule {}
```

Includes the services:

```typescript
import { MacroService, ExtractinatorService, ValueEvent } from 'lassy-xpath';


@Component()
export class ExampleComponent {
    constructor(
        macroService: MacroService,
        private extractinatorService: ExtractinatorService) {
        // set the macros to use in the editor
        macroService.loadDefault();
    }

    inputChanged(event: ValueEvent) {
        this.valid = !event.error;
        this.value = event.xpath;
        console.log(this.extractinatorService.extract(event.xpath));
    }
}
```

Embeds an editor:

```html
<lx-editor [value]="value" (onChange)="inputChanged($event)" autofocus="true"></lx-editor>
```

Use the `ParserService` for parsing/validating a LASSY XML XPath.

## Publishing a new version

*Run `npm run publish` from root or follow these steps:*

1. Compile using `npm run build`
2. `cd dist/lassy-xpath`
3. Optionally run `npm pack` to test the package locally
4. Remove the `lassy-xpath-x.xx.x.tgz` file (if generated in 3)
5. Run `npm publish`

---
_Source: https://npm.io/package/lassy-xpath · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
