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

react-hooks-library

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hooks-library - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

demo/UseQueryDemo.tsx

5

dist/hooks/useQuery.js

@@ -12,6 +12,6 @@ import * as tslib_1 from "tslib";

var _d = useState(undefined), intervalIndex = _d[0], setIntervalIndex = _d[1];
var _e = useState(false), isCalled = _e[0], setIsCalled = _e[1];
var prevVariable = usePrevious(props.variable);
var isVariableChange = function () {
if (props.variable === undefined ||
!isEqual(prevVariable, props.variable)) {
if (!isCalled || !isEqual(prevVariable, props.variable)) {
return true;

@@ -31,2 +31,3 @@ }

setLoading(true);
setIsCalled(true);
return [4 /*yield*/, props.query(props.variable)];

@@ -33,0 +34,0 @@ case 1:

36

jest/setupTests.js

@@ -1,30 +0,10 @@

// /** Jest test setup file. */
// const ReactDOM = require('react-dom');
/** Jest test setup file. */
const ReactDOM = require('react-dom');
// // optional
// window.requestAnimationFrame = callback => {
// setTimeout(callback, 0);
// };
// optional
window.requestAnimationFrame = callback => {
setTimeout(callback, 0);
};
// // https://github.com/facebook/react/issues/11565
// ReactDOM.createPortal = node => node;
const chai = require('chai')
const jest = require('jest')
// Make sure chai and jasmine ".not" play nice together
const originalNot = Object.getOwnPropertyDescriptor(chai.Assertion.prototype, 'not').get
Object.defineProperty(chai.Assertion.prototype, 'not', {
get() {
Object.assign(this, this.assignedNot)
return originalNot.apply(this)
},
set(newNot) {
this.assignedNot = newNot
return newNot
},
})
global.jestExpect = jest.expect
global.chaiExpect = chai.expect
// https://github.com/facebook/react/issues/11565
ReactDOM.createPortal = node => node;
{
"name": "react-hooks-library",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",

@@ -5,0 +5,0 @@ "scripts": {

@@ -22,9 +22,7 @@ import { useState, useEffect } from 'react'

)
const [isCalled, setIsCalled] = useState(false)
const prevVariable = usePrevious(props.variable)
const isVariableChange = () => {
if (
props.variable === undefined ||
!isEqual(prevVariable, props.variable)
) {
if (!isCalled || !isEqual(prevVariable, props.variable)) {
return true

@@ -42,2 +40,3 @@ }

setLoading(true)
setIsCalled(true)

@@ -44,0 +43,0 @@ const response = await props.query(props.variable)

@@ -17,13 +17,13 @@ import { Currency } from '../../src/fields'

it('should have yuan', () => {
chaiExpect(currency.yuan).to.be.equal(1)
expect(currency.yuan).toBe(1)
})
it('should have format function', () => {
chaiExpect(currency.format()).to.be.equal('1.00')
expect(currency.format()).toBe('1.00')
currency.value = 1000000
chaiExpect(currency.format()).to.be.equal('10,000.00')
chaiExpect(currency.format('0.0')).to.be.equal('10000.0')
expect(currency.format()).toBe('10,000.00')
expect(currency.format('0.0')).toBe('10000.0')
})
})

@@ -15,4 +15,4 @@ import { Date } from '../../src/fields'

it('should have format function', () => {
chaiExpect(date.format()).to.be.equal('2012-11-11')
expect(date.format()).toBe('2012-11-11')
})
})

@@ -17,13 +17,13 @@ import { Numeric } from '../../src/fields'

it('should have defaultFormatString', () => {
chaiExpect(numeric['defaultFormatString']).to.be.equal('0,0.00')
expect(numeric['defaultFormatString']).toBe('0,0.00')
})
it('should have format function', () => {
chaiExpect(numeric.format()).to.be.equal('1.00')
expect(numeric.format()).toBe('1.00')
numeric.value = 10000
chaiExpect(numeric.format()).to.be.equal('10,000.00')
chaiExpect(numeric.format('0.0')).to.be.equal('10000.0')
expect(numeric.format()).toBe('10,000.00')
expect(numeric.format('0.0')).toBe('10000.0')
})
})

@@ -13,3 +13,3 @@ import { Presentation } from '../../src/fields'

it('should have valueDisplayName', () => {
chaiExpect(presentation.valueDisplayName).to.be.equal('test')
expect(presentation.valueDisplayName).toBe('test')

@@ -20,4 +20,4 @@ presentation.valueMapper = {

chaiExpect(presentation.valueDisplayName).to.be.equal('测试')
expect(presentation.valueDisplayName).toBe('测试')
})
})

@@ -207,3 +207,3 @@ {

"no-inferrable-types": true,
"no-inferred-empty-object-type": true,
"no-inferred-empty-object-type": false,
"no-internal-module": true,

@@ -210,0 +210,0 @@ "no-invalid-template-strings": true,

Sorry, the diff of this file is not supported yet

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