Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement parse method to parse data in files #33

Closed
1 task
qfox opened this issue May 10, 2016 · 1 comment
Closed
1 task

Implement parse method to parse data in files #33

qfox opened this issue May 10, 2016 · 1 comment
Assignees

Comments

@qfox
Copy link
Contributor

qfox commented May 10, 2016

Ref: #6

Methods:

  • parse(data: {version: ?string, blocks: ?object[], decl: ?object[]): BEMEntityParts[]

The method should determine the format of the file content.

BEMDECL 1.0

exports.blocks = [
    { name: 'block' }
];

or

exports.version = '1.0';
exports.decl = [
    { name: 'block' }
];

BEMDECL 2.0

exports.version = '2.0';
exports.decl = [
    { block: 'block' }
];

BEMDECL next

exports.version = 'next';
exports.decl = [
    { block: 'block' }
];

The method should translate any format to normalized BEMDECL 2.0.

var parse = require('bem-decl').parse;

// bemdecl-1.0.js
// exports.blocks = [
//     { name: 'block' }
// ];

parse(fs.readFileSync('bemdecl-1.0.js')); // [{ block: 'block' }]
@qfox
Copy link
Contributor Author

qfox commented May 11, 2016

Prbbly parse isn't the best name for this method. Any other suggestions?

qfox added a commit that referenced this issue May 11, 2016
@qfox qfox self-assigned this May 11, 2016
qfox added a commit that referenced this issue May 11, 2016
qfox added a commit that referenced this issue May 18, 2016
@blond blond closed this as completed in #34 May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants