Skip to content

Commit

Permalink
add badge
Browse files Browse the repository at this point in the history
  • Loading branch information
beizhedenglong committed Jan 14, 2019
1 parent b02a316 commit 71f9349
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# React Hooks Lib · [![Build Status](https://travis-ci.org/beizhedenglong/react-hooks-lib.svg?branch=master)](https://travis-ci.org/beizhedenglong/react-hooks-lib)
# React Hooks Lib · ![](https://img.shields.io/github/license/beizhedenglong/react-hooks-lib.svg) [![Build Status](https://travis-ci.org/beizhedenglong/react-hooks-lib.svg?branch=master)](https://travis-ci.org/beizhedenglong/react-hooks-lib)

A set of reusable [React Hooks](https://reactjs.org/docs/hooks-reference.html#usestate).

Expand All @@ -19,13 +19,13 @@ Visit [here](https://github.com/beizhedenglong/react-hooks-lib/blob/master/examp
| [`useWillUnmount`](#usewillunmountf) | f | - |
| [`useDidUpdate`](#usedidupdatef-options) | f, conditions | - |
| <h6>State</h6> | | |
| [`createContextState`](#createContextStateInitial) | initial | { ContextProvider, ContextConsumer, set, useContextState} |
| [`createGlobalState`](#createGlobalStateInitial) | initial | { GlobalProvider, GlobalConsumer, set, useGlobalState} |
| [`createContextState`](#createContextStateInitial) | initial | { ContextProvider, ContextConsumer, set, useContextState} |
| [`createGlobalState`](#createGlobalStateInitial) | initial | { GlobalProvider, GlobalConsumer, set, useGlobalState} |
| [`useMergeState`](#usemergestateinitial) | initial | { state, set } |
| [`useCounter`](#useCounterInitial) | initial | { count, set, reset, inc, dec } |
| [`useCounter`](#useCounterInitial) | initial | { count, set, reset, inc, dec } |
| [`useToggle`](#useToggleInitial) | initial | { on, set, reset, toggle } |
| [`useList`](#useListInitial) | initial | { list, set, reset, push, sort, filter } |
| [`useMap`](#useMapInitial) | initial | { values, set, reset, clear, get, has, del } |
| [`useMap`](#useMapInitial) | initial | { values, set, reset, clear, get, has, del } |
| <h6>Network</h6> | | |
| [`useFetch`](#useFetchInitialUrl-initialOptions-onMount) | initialUrl, initialOptions, onMount | { loading, data, error, fetch, setUrl, setOptions } |
| [`useOnlineStatus`](#useonlinestatus) | | |
Expand Down
11 changes: 7 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const isNil = x => x == null

export const cancelablePromise = (promise) => {

export const cancelablePromise = /* istanbul ignore next */ (promise) => {
let hasCanceled = false

const wrappedPromise = new Promise((resolve, reject) => {
Expand All @@ -16,16 +17,18 @@ export const cancelablePromise = (promise) => {
}
}

const hasOwn = Object.prototype.hasOwnProperty

const is = (x, y) => {
const hasOwn = /* istanbul ignore next */ Object.prototype.hasOwnProperty

const is = /* istanbul ignore next */ (x, y) => {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y
}
return x !== x && y !== y // eslint-disable-line
}

export const shallowEqual = (objA, objB) => {

export const shallowEqual = /* istanbul ignore next */ (objA, objB) => {
if (is(objA, objB)) return true

if (typeof objA !== 'object' || objA === null
Expand Down

0 comments on commit 71f9349

Please sign in to comment.