packages/mdast-util-to-bemjson/lib/transform.js
function augmentFactory(augmentFunction) {

        /**
         * Apply custom augmentation and insert back to subtree
         *
         * @function AugmentFunction
         * @param {Object} bemNode - representation of bem entity
         * @returns {Object} bemNode
         */
        function augment(bemNode) {
            const hasChildren = _hasChildren(bemNode.content);
            const bemNodeClone = hasChildren ? omit(bemNode, ['content']) : cloneDeep(bemNode);
            const augmentedBemNode = augmentFunction(bemNodeClone);

            /* Check that if we has children augmentation doesn't modify content */
            assert(
                !hasChildren || !augmentedBemNode.content,
                'You are not allow to modify subtree of bemNode. To do that please use bem-xjst@'
            );

            if (hasChildren) {
                augmentedBemNode.content = bemNode.content;
            }

            return augmentedBemNode;
        }

        return augment;
    }
function augmentFactory(augmentFunction) {

        /**
         * Apply custom augmentation and insert back to subtree
         *
         * @function AugmentFunction
         * @param {Object} bemNode - representation of bem entity
         * @returns {Object} bemNode
         */
        function augment(bemNode) {
            const hasChildren = _hasChildren(bemNode.content);
            const bemNodeClone = hasChildren ? omit(bemNode, ['content']) : cloneDeep(bemNode);
            const augmentedBemNode = augmentFunction(bemNodeClone);

            /* Check that if we has children augmentation doesn't modify content */
            assert(
                !hasChildren || !augmentedBemNode.content,
                'You are not allow to modify subtree of bemNode. To do that please use bem-xjst@'
            );

            if (hasChildren) {
                augmentedBemNode.content = bemNode.content;
            }

            return augmentedBemNode;
        }

        return augment;
    }
function augmentFactory ( augmentFunction ) { /**
         * Apply custom augmentation and insert back to subtree
         *
         * @function AugmentFunction
         * @param {Object} bemNode - representation of bem entity
         * @returns {Object} bemNode
         */ function augment ( bemNode ) { const hasChildren = _hasChildren ( bemNode . content ) ; const bemNodeClone = hasChildren ? omit ( bemNode , [ 'content' ] ) : cloneDeep ( bemNode ) ; const augmentedBemNode = augmentFunction ( bemNodeClone ) ; /* Check that if we has children augmentation doesn't modify content */ assert ( ! hasChildren || ! augmentedBemNode . content , 'You are not allow to modify subtree of bemNode. To do that please use bem-xjst@' ) ; if ( hasChildren ) { augmentedBemNode . content = bemNode . content ; } return augmentedBemNode ; } return augment ; }
Create augment function, for apply custom transformations

@param {BjsonConverter~augmentCallback} augmentFunction - callback with custom augmentation
@returns {BjsonConverter~augment}
Create augment function for apply custom transformations