Socket
Socket
Sign inDemoInstall

js-yaml-concat-seqs

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    js-yaml-concat-seqs

js-yaml concatenate / merge sequences / arrays


Version published
Maintainers
1
Created

Changelog

Source

[1.0.1] - 2023-04-05

  • Remove test.js and usage.js from NPM package

Readme

Source

js-yaml-concat-seqs

CI NPM version

This js-yaml type is inspired by Ingy döt Net comment in the original Yaml Issue #48 discussing merging sequences. He suggested that a tag is a valid option to denote merging of sequences, or how he called it !concat-seqs. I took the type system from the original js-yaml library and extended it with a one-line extension for the concat-seqs function as proposed.

This is a lightweight library (literally 5 lines of code), without any external dependencies other than js-yaml. Requires Node 11 for Array.prototype.flat() to be available.

js-yaml extra type:

  • !!concat-seqs [*seq1, ..., *seq2]

Installation

npm install js-yaml-concat-seqs

Usage

import yaml from "js-yaml";
import type from "js-yaml-concat-seqs";

const schema = yaml.DEFAULT_SCHEMA.extend([ type ]);

const src = `
- &seq1
  - qux
  - qox
- &seq2
  - qix
  - qax
- !!concat-seqs
  - *seq1
  - - foo
    - bar
  - *seq2
`;

console.log(yaml.load(src, { schema }));

Keywords

FAQs

Last updated on 05 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc