Socket
Book a DemoInstallSign in
Socket

mirror-own

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mirror-own

Mirror (copy) the own property descriptors from one object, onto another

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

mirror-own Version Badge

github actions coverage License Downloads

npm badge

Mirror (copy) the own property descriptors from one object, onto another.

Getting started

npm install --save mirror-own

Usage/Examples

const assert = require('assert');
const mirrorOwn = require('mirror-own');

const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' };
const b = { c: 3 };

mirrorOwn(a, b);

assert.deepEqual(a, { a: 1, b: 2, [Symbol.toStringTag]: 'foo' }, 'source object unchanged');
assert.deepEqual(b, { a: 1, b: 2, c: 3, [Symbol.toStringTag]: 'foo' }, 'target object changed');

Options

You may pass an optional options object as the third argument. The available options are:

skipFailures

Must be a boolean, if present. If true, then non-configurable keys on to will be silently skipped.

omit

Must be a predicate function, if present. It will be invoked once per key of from, and if it returns a truthy value, that key will not be mirrored onto to.

Tests

Clone the repo, npm install, and run npm test

Keywords

copy

FAQs

Package last updated on 03 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts