npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-mori-proptypes

v0.0.5

Published

React PropType validators for mori

Readme

react-mori-proptypes npm version Circle CI

PropType validators that work with Mori.js.

About

This package was inspired by react-immutable-proptypes, which I had used often. Striving to become more FRP, I have switched to using mori.js for my immutable needs. I could not find a similar package for validating propTypes with mori data structures, so created this package and used react-immutable-proptypes as a base.

Getting Started

Install

npm install react-mori-proptypes --save

Usage

Usage is simple, they work with and like any React.PropType.* validator.

import MoriPropTypes from 'react-mori-proptypes';
import { vector } from 'mori';

const MyComponent extends React.Component {

  static propTypes = {
    someMap: MoriPropTypes.map.isRequired,
    someVec: MoriPropTypes.vec,
  };

  static defaultProps = {
    someVec: vector(1, 2, 3, 4),
  };

  render() {
    ...
  }

}

API

React-Mori-PropTypes has:

Primitive Types

MoriPropTypes.list         // mori.isList
MoriPropTypes.map          // mori.isMap
MoriPropTypes.queue        // isQueue
MoriPropTypes.range        // isRange
MoriPropTypes.set          // mori.isSet
MoriPropTypes.sortedMap    // isSortedMap
MoriPropTypes.sortedSet    // isSortedSet
MoriPropTypes.vec          // mori.isVec

Collection Types

MoriPropTypes.listOf         // based on React.PropTypes.arrayOf
MoriPropTypes.mapOf          // similar to MoriPropTypes.vecOf, but specific to maps
MoriPropTypes.queueOf        // similar to MoriPropTypes.vecOf, but specific to queues
MoriPropTypes.setOf          // similar to MoriPropTypes.vecOf, but specific to sets
MoriPropTypes.sortedMap      // similar to MoriPropTypes.vecOf, but specific to sortedMaps
MoriPropTypes.sortedSet      // similar to MoriPropTypes.vecOf, but specific to sortedSets
MoriPropTypes.vecOf          // based on React.PropTypes.arrayOf

Contains Types

React-Mori-PropTypes also supports a contains type, which is analogous to React.PropTypes.shape type. This propType validator supports defining the shape of a hashMap, I.E. the keys/value types. You should only use a mori.map or mori.sortedMap with contains.

It is used the same way as shape:

static propTypes = {
  person: MoriPropTypes.contains({
    firstName: React.PropTypes.string.isRequired,
    lastName: React.PropTypes.string.isRequired,
    age: React.PropTypes.number,
  })
};

static defaultProps = {
  person: mori.hashMap('firstName', 'John', 'lastName', 'Smith')
}

Contributing

Issues, feedback, and PR's welcome. Please follow the linter rules.