New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arc-object

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arc-object - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

test/duckInstanceOf.js

15

index.js

@@ -225,2 +225,17 @@ "use strict";

static duckInstanceOf(_primary,_duck){
if(is(_primary) !== 'object' || is(_duck) !== 'object'){
return false;
}
var prop;
for(prop in _primary){
if(_primary.hasOwnProperty(prop) && is(_primary[prop]) === 'function'){
if(is(_duck[prop]) !== 'function'){
return false;
}
}
}
return true;
}
//Take dynamic arguments and check that they're initialized objects

@@ -227,0 +242,0 @@ static check(){

2

package.json
{
"name": "arc-object",
"version": "1.2.1",
"version": "1.3.0",
"description": "An object convenience subclass",

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

@@ -169,2 +169,31 @@ # arc-object [![Build Status](https://travis-ci.org/anyuzer/arc-object.svg?branch=master)](https://travis-ci.org/anyuzer/arc-object)

### ArcObject.duckInstanceOf(primary:Object,duck:Object)
Compare two objects to see if the duck object has the same properties bound as functions as the primary object
```js
//Example class
class Test{
getSomething(){}
}
//Two seperate instantiations
var primary = new Test;
primary.id = "one thing";
var duck = new Test;
duck.id = "another thing";
//Comparison
(primary == duck); //false
(primary === duck); //false
ArcObject.duckInstanceOf(primary,duck); //true
//Change the interface on the primary, so the duck no longer matches
primary.newFunc = function(){};
ArcObject.duckInstanceOf(primary,duck); //false
//But reverse the order...
ArcObject.duckInstanceOf(duck,primary); //true (because we are not comparing if the interfaces are identical, only if the secondary has the same interface as the primary)
```
### ArcObject.check(...args)

@@ -171,0 +200,0 @@ This is a static method that can be used to check whether or not an object chain has been instantiated.

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