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

react-jss

Package Overview
Dependencies
Maintainers
2
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-jss - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

31

lib/index.js

@@ -29,5 +29,7 @@ 'use strict';

function decorate(_jss, DecoratedComponent, rules, options) {
function decorate(DecoratedComponent, rules, options) {
var _class, _temp;
var _jss = arguments.length <= 3 || arguments[3] === undefined ? _jss3.default : arguments[3];
var refs = 0;

@@ -100,20 +102,31 @@ var sheet = null;

function useSheet(_jss, DecoratedComponent, rules, options) {
/**
* It has 3 different use cases:
*
* - binding to a specific jss version `useSheet(jss)`, returns a bound useSheet
* function, default is the global jss instance
* - manual decoration `useSheet(Component, rules, options)`
* - decoration by @decorator, which produces `useSheet(rules, options)(Component)`
*/
function useSheet(DecoratedComponent, rules, options) {
// User creates a useSheet function bound to a specific jss version.
if (_jss instanceof _jss3.default.constructor && !DecoratedComponent) {
return useSheet.bind(null, _jss3.default);
// DecoratedComponent is Jss instance.
if (DecoratedComponent instanceof _jss3.default.constructor && !rules) {
return useSheet.bind(DecoratedComponent);
}
// Manually called by user: `useSheet(DecoratedComponent, rules, options)`
var _jss = this instanceof _jss3.default.constructor ? this : undefined;
// Manually called by user: `useSheet(DecoratedComponent, rules, options)`.
if (typeof DecoratedComponent === 'function') {
return decorate.apply(undefined, arguments);
return decorate.apply(undefined, Array.prototype.slice.call(arguments).concat([_jss]));
}
// Used a decorator: `useSheet(rules, options)(DecoratedComponent)`
// Used as a decorator: `useSheet(rules, options)(DecoratedComponent)`.
options = rules;
rules = DecoratedComponent;
options = rules;
return function (_DecoratedComponent) {
return decorate(_jss, _DecoratedComponent, rules, options);
return decorate(_DecoratedComponent, rules, options, _jss);
};
}
{
"name": "react-jss",
"version": "2.0.4",
"version": "2.0.5",
"description": "JSS mixin for React components",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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