1
0
mirror of https://github.com/thangisme/notes.git synced 2024-06-26 01:05:35 +00:00
notes/node_modules/stylelint/lib/utils/findAtRuleContext.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

22 lines
418 B
JavaScript

/* @flow */
"use strict"
/**
* Find the at-rule in which a rule is nested.
*
* Returns `null` if the rule is not nested within an at-rule.
*/
module.exports = function findAtRuleContext(
rule/*: postcss$rule */
)/*: ?postcss$atRule*/ {
const parent = rule.parent
if (parent.type === "root") {
return null
}
if (parent.type === "atrule") {
return parent
}
return findAtRuleContext(parent)
}