.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / blockString.js
1 /* @flow */
2 "use strict";
3 const beforeBlockString = require("./beforeBlockString");
4 const hasBlock = require("./hasBlock");
5 const rawNodeString = require("./rawNodeString");
6
7 /**
8  * Return a CSS statement's block -- the string that starts and `{` and ends with `}`.
9  *
10  * If the statement has no block (e.g. `@import url(foo.css);`),
11  * return undefined.
12  *
13  * @param {Rule|AtRule} statement - postcss rule or at-rule node
14  * @return {string|undefined}
15  */
16 module.exports = function(
17   statement /*: postcss$rule | postcss$atRule*/
18 ) /*: string | boolean*/ {
19   if (!hasBlock(statement)) {
20     return false;
21   }
22   return rawNodeString(statement).slice(beforeBlockString(statement).length);
23 };