<commit_before>import {
    document,
    DEFAULT_NAMESPACE_PREFIX,
    DEFAULT_NAMESPACE_URI,
    NAMESPACE_SEPARATOR,
    TYPE_STRING
} from './core'
import { ElementAssembler } from './element'
import { NodeAssembler } from './node'

const { Element } = window

const DEFAULT_ATTR_VALUE = ''

export class AttrAssembler extends NodeAssembler {
    /**
     * @param {*} init
     */
    init(init) {
        if(typeof init === TYPE_STRING) this.value = init
        else {
            if(init && init.node) {
                this.node = init.node
            }
            else if(!init || !('value' in init)) {
                this.value = this.constructor.value
            }
            super.init(init)
        }
    }

    /**
     * @param {*} value
     */
    set value(value) {
        this.node.value = value
    }

    /**
     * @returns {*}
     */
    get value() {
        return this.node.value
    }

    /**
     * @param {*} ownerElement
     */
    set ownerElement(ownerElement) {<commit_msg>AttrAssembler: refactoring<commit_after>import {
    Attr,
    DEFAULT_NAMESPACE_PREFIX,
    DEFAULT_NAMESPACE_URI,
    Element,
    NAMESPACE_SEPARATOR,
    TYPE_STRING,
    document,
} from './core'
import { ElementAssembler } from './element'
import { NodeAssembler } from './node'

const DEFAULT_ATTR_VALUE = ''
const VALUE_PROPERTY_NAME = 'value'

export class AttrAssembler extends NodeAssembler {
    /**
     * @param {*} init
     */
    init(init) {
        if(typeof init === TYPE_STRING) this.value = init
        else {
            if(init && init.node instanceof Attr) {
                this.node = init.node
            }
            else if(!init || !init.hasOwnProperty(VALUE_PROPERTY_NAME)) {
                this.value = this.constructor.value
            }
            super.init(init)
        }
    }

    /**
     * @param {*} value
     */
    set value(value) {
        this.node.value = value
    }

    /**
     * @returns {*}
     */
    get value() {
        return this.node.value
    }

    /**
     * @param {*} ownerElement
     */
    set ownerElement(ownerElement) {
{'fraction_non_alphanumeric': 0.12429111531190926, 'fraction_numerical': 0.0, 'mean_word_length': 1.7709424083769634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2788931', 'n_tokens_mistral': 652, 'n_tokens_neox': 647, 'n_words': 127}