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

react-powerhooks

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-powerhooks - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

82

dist/index.es.js
import { useState, useCallback, useEffect } from 'react';
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var slicedToArray = function () {

@@ -135,3 +176,42 @@ function sliceIterator(arr, i) {

export { index as useToggle, index$1 as useActive, index$2 as useInterval };
//initial={{ sounds: true, music: true, graphics: 'medium' }}
var index$3 = (function (initial) {
var _useState = useState(function () {
return initial;
}),
_useState2 = slicedToArray(_useState, 2),
mapValue = _useState2[0],
setMapValue = _useState2[1];
return {
values: mapValue,
clear: function clear() {
return setMapValue({});
},
reset: function reset() {
return setMapValue(initial);
},
set: function set$$1(key, updater) {
setMapValue(function (prev) {
return _extends({}, prev, defineProperty({}, key, typeof updater === "function" ? updater(prev[key]) : updater));
});
},
get: function get$$1(key) {
return mapValue[key];
},
has: function has(key) {
return mapValue[key] != null;
},
delete: function _delete(key) {
return setMapValue(function (_ref) {
var deleted = _ref[key],
prev = objectWithoutProperties(_ref, [key]);
return prev;
});
}
};
});
export { index as useToggle, index$1 as useActive, index$2 as useInterval, index$3 as useMap };
//# sourceMappingURL=index.es.js.map

@@ -7,2 +7,43 @@ 'use strict';

var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var slicedToArray = function () {

@@ -140,5 +181,45 @@ function sliceIterator(arr, i) {

//initial={{ sounds: true, music: true, graphics: 'medium' }}
var index$3 = (function (initial) {
var _useState = react.useState(function () {
return initial;
}),
_useState2 = slicedToArray(_useState, 2),
mapValue = _useState2[0],
setMapValue = _useState2[1];
return {
values: mapValue,
clear: function clear() {
return setMapValue({});
},
reset: function reset() {
return setMapValue(initial);
},
set: function set$$1(key, updater) {
setMapValue(function (prev) {
return _extends({}, prev, defineProperty({}, key, typeof updater === "function" ? updater(prev[key]) : updater));
});
},
get: function get$$1(key) {
return mapValue[key];
},
has: function has(key) {
return mapValue[key] != null;
},
delete: function _delete(key) {
return setMapValue(function (_ref) {
var deleted = _ref[key],
prev = objectWithoutProperties(_ref, [key]);
return prev;
});
}
};
});
exports.useToggle = index;
exports.useActive = index$1;
exports.useInterval = index$2;
exports.useMap = index$3;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "react-powerhooks",
"version": "0.0.6",
"version": "0.0.7",
"description": "Hooks api for common powerplugs",

@@ -5,0 +5,0 @@ "author": "pkodmad",

@@ -10,4 +10,6 @@ <div align="center">

[Demo](https://codesandbox.io/s/j31y1l90m3)
### Demo
![Edit react-powerhooks example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/j31y1l90m3)
### Install

@@ -80,1 +82,20 @@

```
#### useMap
This hook allows you to use a map object and get methods to manipulate the map.
Takes an `initialValue`
_Usage_
```jsx
const {
set: setKey,
get: getKey,
has,
delete: deleteKey,
clear,
reset,
values
} = useMap({ name: "PK", age: "30", occupation: "Reactor" });
```

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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