source: node_modules/es-toolkit/dist/compat/object/create.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 580 bytes
Line 
1import { keys } from './keys.mjs';
2import { assignValue } from '../_internal/assignValue.mjs';
3import { isObject } from '../predicate/isObject.mjs';
4
5function create(prototype, properties) {
6 const proto = isObject(prototype) ? Object.create(prototype) : {};
7 if (properties != null) {
8 const propsKeys = keys(properties);
9 for (let i = 0; i < propsKeys.length; i++) {
10 const key = propsKeys[i];
11 const propsValue = properties[key];
12 assignValue(proto, key, propsValue);
13 }
14 }
15 return proto;
16}
17
18export { create };
Note: See TracBrowser for help on using the repository browser.