is-equal-shallow

WebJar for is-equal-shallow

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

is-equal-shallow
Последняя версия

Последняя версия

0.1.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

is-equal-shallow
WebJar for is-equal-shallow
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/jonschlinkert/is-equal-shallow

Скачать is-equal-shallow

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/is-equal-shallow/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>is-equal-shallow</artifactId>
    <version>0.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/is-equal-shallow/
implementation 'org.webjars.npm:is-equal-shallow:0.1.3'
// https://jarcasting.com/artifacts/org.webjars.npm/is-equal-shallow/
implementation ("org.webjars.npm:is-equal-shallow:0.1.3")
'org.webjars.npm:is-equal-shallow:jar:0.1.3'
<dependency org="org.webjars.npm" name="is-equal-shallow" rev="0.1.3">
  <artifact name="is-equal-shallow" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='is-equal-shallow', version='0.1.3')
)
libraryDependencies += "org.webjars.npm" % "is-equal-shallow" % "0.1.3"
[org.webjars.npm/is-equal-shallow "0.1.3"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : is-primitive jar [2.0.0,3)

Модули Проекта

Данный проект не имеет модулей.

is-equal-shallow NPM version Build Status

Does a shallow comparison of two objects, returning false if the keys or values differ.

The purpose of this lib is to do the fastest comparison possible of two objects when the values will predictably be primitives.

  • only compares objects.
  • only compares the first level of each object
  • values must be primitives. If a value is not a primitive, even if the values are the same, false is returned.

Install with npm

$ npm i is-equal-shallow --save

Usage

// legacy cjs require
var equals = require('is-equal-shallow');
// use es6 import
import equals from 'is-equal-shallow';

equals(object_a, object_b);

Examples

equals({a: true, b: true}, {a: true, b: true});
//=> 'true'

equals({a: true, b: false}, {c: false, b: false});
//=> 'false'

equals({a: true, b: false}, {a: false, b: false});
//=> 'false'

Strict comparison for equality:

equals({a: true, b: true}, {a: true, b: 'true'});
//=> 'false'

When values are not primitives, false is always returned:

equals({ b: {}}, { b: {}});
//=> 'false'

equals({ b: []}, { b: []});
//=> 'false'

Related projects

Other object utils:

  • clone-deep: Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
  • for-in: Iterate over the own and inherited enumerable properties of an objecte, and return an object… more
  • for-own: Iterate over the own enumerable properties of an object, and return an object with properties… more
  • is-plain-object: Returns true if an object was created by the Object constructor.
  • isobject: Returns true if the value is an object and not an array or null.

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on June 22, 2015.

Версии библиотеки

Версия
0.1.3
0.1.2