EN
Forum

Methodology

Toolbox

Platform

naming.cell.pattern-parser

Thing to parse template-strings-like patterns.

Install

npm i @bem/sdk.naming.cell.pattern-parser

Usage

const parse = require('@bem/sdk.naming.cell.pattern-parser');

parse('1/${some}/2/${more}/3');
// → ['1/', 'some', '/2/', 'more', '/3']

parse('${entity}${layer?@${layer}}.${tech}');
// → ['', 'entity', '', ['layer', '@', 'layer'], '.', 'tech']

Options

ParameterTypeDescriptionpatternstringPattern to parse

License

Code and documentation © 2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.

Оцените статью
Report an error on GitHub or correct using prose.io.