Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nanoclone

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanoclone - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

30

index.js

@@ -1,8 +0,16 @@

module.exports = function clone (src) {
// ES6 Map
var map
try {
map = Map
} catch (_) {}
var set
// ES6 Set
try {
set = Set
} catch (_) {}
module.exports = function clone(src) {
// Null/undefined/functions/etc
if (
!src ||
typeof src !== 'object' ||
typeof src === 'function'
) {
if (!src || typeof src !== 'object' || typeof src === 'function') {
return src

@@ -31,2 +39,12 @@ }

// ES6 Maps
if (map && src instanceof map) {
return new Map(Array.from(src.entries()))
}
// ES6 Sets
if (set && src instanceof set) {
return new Set(Array.from(src.values()))
}
// Object

@@ -33,0 +51,0 @@ if (src instanceof Object) {

4

package.json
{
"name": "nanoclone",
"version": "0.1.3",
"description": "290B to deep clone JavaScript objects",
"version": "0.1.4",
"description": "200B to deep clone JavaScript objects",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc