Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bpmn-io/moddle-utils

Package Overview
Dependencies
Maintainers
9
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bpmn-io/moddle-utils

[![CI](https://github.com/bpmn-io/moddle-utils/workflows/CI/badge.svg)](https://github.com/bpmn-io/moddle-utils/actions?query=workflow%3ACI)

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
9
Created
Source

@bpmn-io/moddle-utils

CI

Utils for moddle. 🛠️

API

getPath

import { getPath } from '@bpmn-io/moddle-utils';

// global
getPath(moddleElement); // [ 'rootElements', 0, 'flowElements', 0, 'extensionElements', 'values', 0 ]

// local
getPath(moddleElement, parentModdleElement); // [ 'extensionElements', 'values', 0 ]

// $parent === undefined
const task = moddle.create('bpmn:Task');

getPath(task); // null

// null
getPath(null); // null

pathConcat

import { pathConcat } from '@bpmn-io/moddle-utils';

pathConcat([ 'foo', 'bar' ], 'baz'); // [ 'foo', 'bar', 'baz' ]

// null
pathConcat([ 'foo', 'bar' ], null); // null

pathEquals

import { pathEquals } from '@bpmn-io/moddle-utils';

// default separator
pathEquals('extensionElements.values.0.type', 'extensionElements.values.0.type'); // true

pathEquals([ 'extensionElements', 'values', 0 ], [ 'extensionElements', 'values', 0 ]); // true

// custom separator
pathEquals('extensionElements-values-0-type', 'extensionElements-values-0-type', '-'); // true

// null
pathEquals(null, [ 'foo' ]); // false

parsePath

import { parsePath } from '@bpmn-io/moddle-utils';

// default separator
parsePath('rootElements.0.flowElements.0.extensionElements.values.0.type'); // [ 'rootElements', 0, 'flowElements', 0, 'extensionElements', 'values', 0 ]

// custom separator
parsePath('rootElements-0-flowElements-0-extensionElements-values-0-type', '-'); // [ 'rootElements', 0, 'flowElements', 0, 'extensionElements', 'values', 0 ]

// null
parsePath(null); // null

stringifyPath

import { stringifyPath } from '@bpmn-io/moddle-utils';

// default separator
stringifyPath([ 'rootElements', 0, 'flowElements', 0, 'extensionElements', 'values', 0 ]); // 'rootElements.0.flowElements.0.extensionElements.values.0.type'

// custom separator
stringifyPath([ 'rootElements', 0, 'flowElements', 0, 'extensionElements', 'values', 0 ], '-'); // 'rootElements-0-flowElements-0-extensionElements-values-0-type'

// null
stringifyPath(null); // null

Licence

MIT

Keywords

FAQs

Package last updated on 17 Jul 2023

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc