|
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 | |
|---|
| 1 | import { keys } from './keys.mjs';
|
|---|
| 2 | import { assignValue } from '../_internal/assignValue.mjs';
|
|---|
| 3 | import { isObject } from '../predicate/isObject.mjs';
|
|---|
| 4 |
|
|---|
| 5 | function 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 |
|
|---|
| 18 | export { create };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.