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

react-on-rails

Package Overview
Dependencies
Maintainers
1
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-on-rails - npm Package Compare versions

Comparing version 2.0.0-beta.3 to 2.0.0-rc.1

7

node_package/lib/ComponentStore.js

@@ -56,3 +56,3 @@ 'use strict';

*/
getComponent: function getComponent(name) {
get: function get(name) {
var ctx = (0, _context2.default)();

@@ -73,4 +73,5 @@ if (_components.has(name)) {

/**
* Get an Object containing all registered components. Useful for debugging.
* @returns {*}
* Get an Map containing all registered components. Useful for debugging.
* @returns Map where key is the component name and values are the
* { name, component, generatorFunction}
*/

@@ -77,0 +78,0 @@ components: function components() {

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,37 +7,18 @@ Object.defineProperty(exports, "__esModule", {

exports.default = generatorFunction;
// See discussion: https://discuss.reactjs.org/t/how-to-determine-if-js-object-is-react-component/2825/2
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function allObjectKeys(obj) {
var result = [];
/* eslint-disable guard-for-in */
for (var prop in obj) {
result.push(prop);
}
return result;
}
function arrIncludes(arr, value) {
return arr.indexOf(value) > -1;
}
/**
* Used to determine we'll call be calling React.createElement on the component of if this is a
* generator function used return a function that takes props to return a React element
* @param component
* @returns {boolean}
*/
function generatorFunction(component) {
var prototypeKeys = allObjectKeys(component.prototype);
var keys = allObjectKeys(component);
// es5 React Component
if (arrIncludes(prototypeKeys, 'constructor') && arrIncludes(prototypeKeys, 'render')) {
if (!component.prototype) {
return false;
} else if (arrIncludes(prototypeKeys, 'isReactComponent') // es6 React Component
|| arrIncludes(keys, 'propTypes') || component.prototype instanceof _react2.default.Component) {
return false;
}
// Else, we assume a generator function!
return true;
// es5 or es6 React Component
var es5OrEs6ReactComponent = component.prototype.isReactComponent;
return !es5OrEs6ReactComponent;
}

@@ -75,3 +75,3 @@ 'use strict';

getComponent: function getComponent(name) {
return _ComponentStore2.default.getComponent(name);
return _ComponentStore2.default.get(name);
},

@@ -78,0 +78,0 @@

{
"name": "react-on-rails",
"version": "2.0.0-beta.3",
"version": "2.0.0-rc.1",
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",

@@ -5,0 +5,0 @@ "main": "node_package/lib/ReactOnRails.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