/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.3.9
src/utils/shallowCopy.js
20 строк
420 B
Julien Deniau
fix new proto key injection
04 мар 2026, 01:10
04 мар 2026, 01:10
94bcd3c
Код
Авторство
О чём код?
import arrCopy from './arrCopy'; import hasOwnProperty from './hasOwnProperty'; import { isProtoKey } from './protoInjection'; export default function shallowCopy(from) { if (Array.isArray(from)) { return arrCopy(from); } const to = {}; for (const key in from) { if (isProtoKey(key)) { continue; } if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } return to; }