This commit is contained in:
2025-07-02 21:55:07 +09:00
commit fa63330e69
855 changed files with 432271 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
// This exists so I'm only saving it once.
"use strict"
var hasOwn = require("./hasOwn")
module.exports = Object.assign || function(target, source) {
for (var key in source) {
if (hasOwn.call(source, key)) target[key] = source[key]
}
}

View File

@@ -0,0 +1,48 @@
"use strict"
// Note: this is mildly perf-sensitive.
//
// It does *not* use `delete` - dynamic `delete`s usually cause objects to bail
// out into dictionary mode and just generally cause a bunch of optimization
// issues within engines.
//
// Ideally, I would've preferred to do this, if it weren't for the optimization
// issues:
//
// ```js
// const hasOwn = require("./hasOwn")
// const magic = [
// "key", "oninit", "oncreate", "onbeforeupdate", "onupdate",
// "onbeforeremove", "onremove",
// ]
// module.exports = (attrs, extras) => {
// const result = Object.assign(Object.create(null), attrs)
// for (const key of magic) delete result[key]
// if (extras != null) for (const key of extras) delete result[key]
// return result
// }
// ```
var hasOwn = require("./hasOwn")
// Words in RegExp literals are sometimes mangled incorrectly by the internal bundler, so use RegExp().
var magic = new RegExp("^(?:key|oninit|oncreate|onbeforeupdate|onupdate|onbeforeremove|onremove)$")
module.exports = function(attrs, extras) {
var result = {}
if (extras != null) {
for (var key in attrs) {
if (hasOwn.call(attrs, key) && !magic.test(key) && extras.indexOf(key) < 0) {
result[key] = attrs[key]
}
}
} else {
for (var key in attrs) {
if (hasOwn.call(attrs, key) && !magic.test(key)) {
result[key] = attrs[key]
}
}
}
return result
}

View File

@@ -0,0 +1,4 @@
// This exists so I'm only saving it once.
"use strict"
module.exports = {}.hasOwnProperty