New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

compare-properties

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compare-properties

Get functions to compare two object properties given an operator.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

compare-properties npm travis

Get functions to compare two values given an operator.

Install

$ npm install —save compare-properties

Usage

var compareFactory = require('compare-properties');

var equal = compareFactory('=', 'foo');
equal({ foo: 42 }, { foo: 42 }); //=> true
equal({ foo: 42 }, { foo: 10 }); //=> false
equal({ foo: 42 }, { bar: 42 }); //=> false

var equal = compareFactory('=', 'foo', 'bar');
equal({ foo: 42 }, { foo: 42 }); //=> false
equal({ foo: 42 }, { bar: 42 }); //=> true

var equal = compareFactory('<', 'foo');
equal({ foo: 'foo' }, { foo: 'foo' }); //=> true
equal({ foo: 'foo' }, { foo: 'fon' }); //=> true
equal({ foo: 1337 }, { bar: 42 }); //=> false

Operators

=<><=>=!=%=
a === ba < ba > ba <= ba >= ba != ba % b === 0

License

MIT © Nicolas Gryman

Keywords

comparator

FAQs

Package last updated on 20 Jun 2015

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