Socket
Book a DemoInstallSign in
Socket

@omicronenergy/oscd-editor

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@omicronenergy/oscd-editor

Function library for basic XML manipulations

1.5.0
latest
Source
npmnpm
Version published
Weekly downloads
31
-50%
Maintainers
3
Weekly downloads
 
Created
Source

This repository hold the XML editing engine inspired by the OpenSCD core and is following the newest agreed OpenSCD Core API

Usage

You can either load and use the handleEdit function through npm or other content delivery networks. This function does manipulate a XMLDocument as per user intent through the edit as its input:

const removeNode: Remove = {node: toBeRemovedNode}
handleEdit(removeNode)

You can also use the exported EditV2Editor class which keeps track of an undo/redo history. This class is a wrapper around the handleEdit function and provides a more user-friendly API. The EditV2Editor class can be used as follows:

import { EditV2Editor } from '@omicronenergy/oscd-editor';

const editor = new EditV2Editor();

const removeNode: Remove = {node: toBeRemovedNode}
editor.handleEdit(removeNode);

expect(toBeRemovedNode.parentNode).to.not.exist;

editor.undo(); // undo the latest edit

expect(toBeRemovedNode.parentNode).to.exist;

editor.redo(); // redo the most recently undone edit

expect(toBeRemovedNode.parentNode).to.not.exist;

Linting and formatting

To scan the project for linting and formatting errors, run

npm run lint

To automatically fix linting and formatting errors, run

npm run format

We use ESLint and Prettier for linting and formatting. Plugins for automatic formatting and linting during editing are available for vim, emacs, VSCode, and all popular IDEs.

Testing with Web Test Runner

To execute a single test run:

npm test

To run the tests in interactive watch mode run:

npm run test:watch

License

This project is licensed under the Apache License 2.0.

© 2025 Jakob Vogelsang, OMICRON electronics GmbH

FAQs

Package last updated on 26 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.