-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
belozer
committed
Jan 26, 2017
1 parent
ad91d23
commit fea9834
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const promisify = require('es6-promisify'); | ||
const stringify = require('./stringify'); | ||
|
||
const writeFile = promisify(fs.writeFile); | ||
|
||
/** | ||
* Save normalized declaration to target format | ||
* | ||
* @param {String} filename Filename for save declaration | ||
* @param {BemCell[]} cells Normalized declaraions | ||
* @param {Object} opts Addtional options | ||
* @param {String} opts.format Format for save declaration | ||
* @param {String} opts.exportType The appointment of a modular system | ||
* @returns {Promise.<void>} | ||
*/ | ||
module.exports = (filename, cells, opts) => { | ||
const data = stringify(cells, Object.assign({ | ||
format: 'v2', | ||
exportType: 'cjs' | ||
}, opts)); | ||
|
||
return writeFile(data) | ||
} |