Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@dx-groups/arthur
Advanced tools
基于业务形成的一个业务框架 ( Inspired by dva )
$ npm install @dx-groups/arthur --save
$ yarn add @dx-groups/arthur
项目中使用 redux 管理状态库,当希望改变状态库的 state 时,使用 dispatch 发起一个 action ,根据 actionType 调用 reducers 改变 state 。arthur 中一个 module.js 包含了一个功能模块的 store、action、reducer 的实现。
import pageModule from './page/module'
// actionType
const GET_FIRST_LIST = 'spa/Arthur/GET_FIRST_LIST'
export default {
// 不能为空,组件会通过 namespace 访问state
namespace: 'arthur',
// 初始状态 state
state: {
first: ''
},
// redux actions,支持 redux-thunk 及 redux-promise
actions: {
getFirstList(arg) {
return dispatch => {
dispatch({
type: GET_FIRST_LIST,
payload: {
name: 'first'
},
})
}
}
},
// redux reducers, 同步操作用于更新 state
reducers: {
[GET_FIRST_LIST]: (state, action) => ({
...state,
first: action.payload,
})
},
children: [
// 下级module.js
pageModule
]
}
import React, { Component } from 'react'
// 此 connect 方法是对 react-redux 中 connect 方法进行了二次封装
import { connect } from '@dx-groups/arthur'
class Page extends Component {
render() {
const { first } = this.props
return (<div>{ first }</div>)
}
}
const mapStateToProps = (state) => {
return {
// ...state.arthur.page 依然支持
...state['arthur.page']
}
}
// 不需要 mapDispatchToProps 方法,store.dispatch 已经在 arthur 框架内塞入组件的 props 中
export default connect(['common.showListSpin', 'arthur.page'],mapStateToProps)(Page)
import arthur from '@dx-groups/arthur'
import { createBrowserHistory } from 'history'
import Router from './router'
import arthurModule from '../modules/Arthur/module'
// 1. initialize
const app = arthur({
history: createBrowserHistory()
})
// 2. execute initialization codes
app.init(() => dispatch => {
})
// 3. modules
app.modules([
arthurModule,
])
// 4. router
app.router(Router)
// 5. start
app.start('#root')
export default app._store
FAQs
Unknown package
We found that @dx-groups/arthur demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.