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

react-router-controller

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-controller - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

15

CHANGELOG.md

@@ -0,1 +1,16 @@

## 0.1.5(2017-09-11)
### 解决bug
- 解决viewId带“-”字符,controller中xxxView函数执行问题
eg. viewId=status-test的会执行statusTestView方法
### 更新
### 新功能
## 0.1.0(2017-08-24)

@@ -2,0 +17,0 @@

4

es/RouteController.js

@@ -17,3 +17,3 @@ 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; };

import { Route } from 'react-router-dom';
import { getParams } from './util';
import { getParams, stringAdapter } from './util';
import { ControllerConfig } from './Controller';

@@ -77,3 +77,3 @@ import DefaultNotMatchComponent from './DefaultNotMatchComponent';

var viewId = params.viewId;
var funcName = viewId + 'View';
var funcName = stringAdapter(viewId) + 'View';
return ControllerConfig.readControllerFile(controllerId).then(function (controller) {

@@ -80,0 +80,0 @@ if (!controller) {

@@ -25,3 +25,33 @@ /**

}
/**
* toUpperCase 小写转大写
* @param {String} string 传进来的字符串
* @param {Int} start 开始位置,默认0
* @param {Int} end 介绍位置,默认1
* @return {string}
*/
export function toUpperCaseByPosition(string) {
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var str1 = string.substr(start, end).toUpperCase();
var str2 = string.substr(end);
return str1 + str2;
}
//字符串如test-large-thing,转换成testLargeThing
export function stringAdapter(str) {
if (!str) {
return str;
}
var splitArr = str.split('-');
var ret = '';
splitArr.forEach(function (v, k) {
if (k !== 0) {
ret += toUpperCaseByPosition(v);
} else {
ret += v;
}
});
return ret;
}
/**

@@ -28,0 +58,0 @@ * 根据viewId和contollerId获取url的配置参数

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

var viewId = params.viewId;
var funcName = viewId + 'View';
var funcName = (0, _util.stringAdapter)(viewId) + 'View';
return _Controller.ControllerConfig.readControllerFile(controllerId).then(function (controller) {

@@ -97,0 +97,0 @@ if (!controller) {

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

exports.pathnameAdapter = pathnameAdapter;
exports.toUpperCaseByPosition = toUpperCaseByPosition;
exports.stringAdapter = stringAdapter;
exports.getParams = getParams;

@@ -33,3 +35,33 @@ /**

}
/**
* toUpperCase 小写转大写
* @param {String} string 传进来的字符串
* @param {Int} start 开始位置,默认0
* @param {Int} end 介绍位置,默认1
* @return {string}
*/
function toUpperCaseByPosition(string) {
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var str1 = string.substr(start, end).toUpperCase();
var str2 = string.substr(end);
return str1 + str2;
}
//字符串如test-large-thing,转换成testLargeThing
function stringAdapter(str) {
if (!str) {
return str;
}
var splitArr = str.split('-');
var ret = '';
splitArr.forEach(function (v, k) {
if (k !== 0) {
ret += toUpperCaseByPosition(v);
} else {
ret += v;
}
});
return ret;
}
/**

@@ -36,0 +68,0 @@ * 根据viewId和contollerId获取url的配置参数

{
"name": "react-router-controller",
"version": "0.1.4",
"version": "0.1.5",
"description": "react-router-controller,react路由控制器",

@@ -5,0 +5,0 @@ "main": "libs/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