naming.cell.match: using a custom naming convention

node v10.24.1
version: 1.0.1
endpointsharetweet
const options = { fs: { scheme: 'flat' } }; const originFlatNaming = require('@bem/sdk.naming.presets/create')(options); const match = require('@bem/sdk.naming.cell.match')(originFlatNaming);
Examples with correct paths.
let correctPath = 'my-layer.blocks/my-block.js'; match(correctPath).isMatch;
match(correctPath).cell.valueOf();
correctPath = 'common.blocks/my-block_my-modifier.css'; match(correctPath).isMatch;
match(correctPath).cell.valueOf();
Examples with incorrect paths.
let incorrectPath = 'my-layer.blocks/my-block.js_some-text'; match(incorrectPath);
match(incorrectPath).cell.valueOf();
incorrectPath = 'some incorrect string'; match(incorrectPath);
incorrectPath = 'my-block/my-block.js'; match(incorrectPath);
Loading…

no comments

    sign in to comment