MCPcopy Index your code
hub / github.com/purifycss/purifycss / getAllWordsInContent

Function getAllWordsInContent

lib/purifycss.js:781–814  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

779};
780
781var getAllWordsInContent = function getAllWordsInContent(content) {
782 var used = {
783 // Always include html and body.
784 html: true,
785 body: true
786 };
787 var words = content.split(/[^a-z]/g);
788 var _iteratorNormalCompletion = true;
789 var _didIteratorError = false;
790 var _iteratorError = undefined;
791
792 try {
793 for (var _iterator = words[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
794 var word = _step.value;
795
796 used[word] = true;
797 }
798 } catch (err) {
799 _didIteratorError = true;
800 _iteratorError = err;
801 } finally {
802 try {
803 if (!_iteratorNormalCompletion && _iterator.return) {
804 _iterator.return();
805 }
806 } finally {
807 if (_didIteratorError) {
808 throw _iteratorError;
809 }
810 }
811 }
812
813 return used;
814};
815
816var getAllWordsInSelector = function getAllWordsInSelector(selector) {
817 // Remove attr selectors. "a[href...]"" will become "a".

Callers 1

purifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected