@tsfun/object
Advanced tools
@@ -7,2 +7,3 @@ import { AddProperty } from './utils/types'; | ||
| * @note If you need own properties, use `setProperty` instead | ||
| * @note If `key` is a property setter in `proto` (such as `__proto__`), the setter will be invoked | ||
| * @param proto Prototype to extends upon | ||
@@ -9,0 +10,0 @@ * @param key Property key |
+2
-2
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const mut_obj_1 = require("./utils/mut-obj"); | ||
| /** | ||
@@ -8,2 +7,3 @@ * Create an object with `proto` as prototype | ||
| * @note If you need own properties, use `setProperty` instead | ||
| * @note If `key` is a property setter in `proto` (such as `__proto__`), the setter will be invoked | ||
| * @param proto Prototype to extends upon | ||
@@ -15,3 +15,3 @@ * @param key Property key | ||
| const object = Object.create(proto); | ||
| mut_obj_1.mutObj(object, key, value); | ||
| object[key] = value; | ||
| return object; | ||
@@ -18,0 +18,0 @@ } |
+2
-3
@@ -1,2 +0,1 @@ | ||
| import { mutObj } from "./utils/mut-obj.mjs"; | ||
| /** | ||
@@ -6,2 +5,3 @@ * Create an object with `proto` as prototype | ||
| * @note If you need own properties, use `setProperty` instead | ||
| * @note If `key` is a property setter in `proto` (such as `__proto__`), the setter will be invoked | ||
| * @param proto Prototype to extends upon | ||
@@ -11,8 +11,7 @@ * @param key Property key | ||
| */ | ||
| export function addProperty(proto, key, value) { | ||
| const object = Object.create(proto); | ||
| mutObj(object, key, value); | ||
| object[key] = value; | ||
| return object; | ||
| } | ||
| export default addProperty; //# sourceMappingURL=add-property.js.map |
@@ -7,2 +7,3 @@ import { AddProperty } from './utils/types'; | ||
| * @note If you need own properties, use `setProperty` instead | ||
| * @note If `key` is a property setter in `proto` (such as `__proto__`), the setter will be invoked | ||
| * @param proto Prototype to extends upon | ||
@@ -9,0 +10,0 @@ * @param key Property key |
+1
-1
| { | ||
| "name": "@tsfun/object", | ||
| "version": "0.0.15", | ||
| "version": "0.0.16", | ||
| "description": "Utilities related to objects", | ||
@@ -5,0 +5,0 @@ "author": "Hoàng Văn Khải <hvksmr1996@gmail.com>", |
52552
0.54%1309
0.15%