strip-json-comments

WebJar for strip-json-comments

Лицензия

Лицензия

MIT
Категории

Категории

JSON Данные
Группа

Группа

org.webjars.bowergithub.sindresorhus
Идентификатор

Идентификатор

strip-json-comments
Последняя версия

Последняя версия

3.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

strip-json-comments
WebJar for strip-json-comments
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/sindresorhus/strip-json-comments

Скачать strip-json-comments

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.sindresorhus/strip-json-comments/ -->
<dependency>
    <groupId>org.webjars.bowergithub.sindresorhus</groupId>
    <artifactId>strip-json-comments</artifactId>
    <version>3.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.sindresorhus/strip-json-comments/
implementation 'org.webjars.bowergithub.sindresorhus:strip-json-comments:3.1.1'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.sindresorhus/strip-json-comments/
implementation ("org.webjars.bowergithub.sindresorhus:strip-json-comments:3.1.1")
'org.webjars.bowergithub.sindresorhus:strip-json-comments:jar:3.1.1'
<dependency org="org.webjars.bowergithub.sindresorhus" name="strip-json-comments" rev="3.1.1">
  <artifact name="strip-json-comments" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.sindresorhus', module='strip-json-comments', version='3.1.1')
)
libraryDependencies += "org.webjars.bowergithub.sindresorhus" % "strip-json-comments" % "3.1.1"
[org.webjars.bowergithub.sindresorhus/strip-json-comments "3.1.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

strip-json-comments

Strip comments from JSON. Lets you use comments in your JSON files!

This is now possible:

{
	// Rainbows
	"unicorn": /* ❤ */ "cake"
}

It will replace single-line comments // and multi-line comments /**/ with whitespace. This allows JSON error positions to remain as close as possible to the original source.

Also available as a Gulp/Grunt/Broccoli plugin.

Install

$ npm install strip-json-comments

Usage

const stripJsonComments = require('strip-json-comments');

const json = `{
	// Rainbows
	"unicorn": /* ❤ */ "cake"
}`;

JSON.parse(stripJsonComments(json));
//=> {unicorn: 'cake'}

API

stripJsonComments(jsonString, options?)

jsonString

Type: string

Accepts a string with JSON and returns a string without comments.

options

Type: object

whitespace

Type: boolean
Default: true

Replace comments with whitespace instead of stripping them entirely.

Benchmark

$ npm run bench

Related


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Версии библиотеки

Версия
3.1.1
3.0.1
2.0.1