<commit_before>import Duckface from 'Duckface/src/duckface'

export function shouldImplement({
    name = 'strictduckInterface', methods = []
}){
    let face = new Duckface(name, methods);
    return instance => Duckface.ensureImplements(instance, face)
}

export default class StrictDuck {
    constructor(instance, ...interfaces){
        Object.assign(this, instance)
        interfaces.forEach(
            i => typeof(i == 'function') ?
                i(this) :
                shouldImplement(i)(this)
        )
    }
}

export function extension({
    name, parent=StrictDuck, interfaces=[]
}){
    let classDict = {}
    classDict[name] = class extends parent {
        constructor(instance, ...otherInterfaces){
            super(instance, ...interfaces, ...otherInterfaces)
        }
    }
    return classDict[name]
}<commit_msg>extend better semantically<commit_after>import Duckface from 'Duckface/src/duckface'

export function shouldImplement({
    name = 'strictduckInterface', methods = []
}){
    let face = new Duckface(name, methods);
    return instance => Duckface.ensureImplements(instance, face)
}

export default class StrictDuck {
    constructor(instance, ...interfaces){
        Object.assign(this, instance)
        interfaces.forEach(
            i => typeof(i == 'function') ?
                i(this) :
                shouldImplement(i)(this)
        )
    }
}

export function extend({
    name, parent=StrictDuck, interfaces=[], methods=[]
}){
    let classDict = {}
    classDict[name] = class extends parent {
        constructor(instance, ...otherInterfaces){
            super(instance, {name, methods},
                  ...interfaces, ...otherInterfaces)
        }
    }
    return classDict[name]
}
{'fraction_non_alphanumeric': 0.12406662837449742, 'fraction_numerical': 0.0, 'mean_word_length': 2.5991735537190084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5645432', 'n_tokens_mistral': 496, 'n_tokens_neox': 484, 'n_words': 109}