<commit_before>var createElement = require("virtual-dom/create-element")
var diff = require("virtual-dom/diff")
var patch = require("virtual-dom/patch")

var MESSAGE = "partial() cannot cache on values. " + 
    "You must specify object arguments. partial("

function copyOver(list, offset) {
    var newList = []
    for (var i = offset; i < list.length; i++) {
        newList[i - offset] = list[i]
    }
    return newList
}

module.exports = partial

function partial(fn) {
    var args = copyOver(arguments, 1)
    var firstArg = args[0]
    var hasObjects = false
    var key

    if (typeof firstArg === "object" && firstArg !== null) {
        hasObjects = true
        if ("key" in firstArg) {
            key = firstArg.key
        } else if ("id" in firstArg) {
            key = firstArg.id
        }
    }

    for (var i = 1; !hasObjects && i < args.length; i++) {
        var arg = args[i];
        if (typeof arg === "object" && arg !== null) {
            hasObjects = true
        }
    }

    if (!hasObjects) {
        throw new Error(MESSAGE + args + ")")
    }
<commit_msg>allow empty partials<commit_after>var createElement = require("virtual-dom/create-element")
var diff = require("virtual-dom/diff")
var patch = require("virtual-dom/patch")

var MESSAGE = "partial() cannot cache on values. " + 
    "You must specify object arguments. partial("

function copyOver(list, offset) {
    var newList = []
    for (var i = offset; i < list.length; i++) {
        newList[i - offset] = list[i]
    }
    return newList
}

module.exports = partial

function partial(fn) {
    var args = copyOver(arguments, 1)
    var firstArg = args[0]
    var hasObjects = args.length === 0
    var key

    if (typeof firstArg === "object" && firstArg !== null) {
        hasObjects = true
        if ("key" in firstArg) {
            key = firstArg.key
        } else if ("id" in firstArg) {
            key = firstArg.id
        }
    }

    for (var i = 1; !hasObjects && i < args.length; i++) {
        var arg = args[i];
        if (typeof arg === "object" && arg !== null) {
            hasObjects = true
        }
    }

    if (!hasObjects) {
        throw new Error(MESSAGE + args + ")")
    }

{'fraction_non_alphanumeric': 0.13761883205070166, 'fraction_numerical': 0.003168854685377999, 'mean_word_length': 2.2028985507246377, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5459847', 'n_tokens_mistral': 691, 'n_tokens_neox': 677, 'n_words': 207}