├── .babelrc ├── .gitignore ├── rollup.config.js ├── README.md ├── Dump.js ├── package.json ├── LICENSE └── index.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-react", "@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | haters/ 3 | 4 | # Project dependencies 5 | .cache 6 | node_modules 7 | 8 | # Build directory 9 | public 10 | 11 | # Other 12 | .DS_Store 13 | yarn-error.log -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import babel from 'rollup-plugin-babel' 2 | 3 | export default { 4 | input: 'Dump.js', 5 | output: { 6 | file: './index.js', 7 | format: 'cjs', 8 | exports: 'named', 9 | external: ['react'], 10 | }, 11 | plugins: [ 12 | babel({ 13 | exclude: 'node_modules/**', 14 | }), 15 | ], 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | Take a dump on your React App. 4 | 5 | If you ever want to just see a value on the page instead of 6 | console.logging() it, use this. 7 | 8 | Put Dump.js in your project and use it: 9 | 10 | ```bash 11 | npm i @wesbos/dump 12 | ``` 13 | 14 | ![](https://wes.io/qNOI/content.png) 15 | 16 | ![](https://wes.io/qOgP/content.png) 17 | 18 | ## FAQ 19 | 20 | ### Q: I Prefer Poop.js because it's superior 21 | 22 | k 23 | -------------------------------------------------------------------------------- /Dump.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Dump = props => ( 4 |
12 | {Object.entries(props).map(([key, val]) => ( 13 |
14 |         
15 |           {key} 💩
16 |         
17 |         {JSON.stringify(val, '', ' ')}
18 |       
19 | ))} 20 |
21 | ); 22 | 23 | export default Dump; 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@wesbos/dump", 3 | "private": false, 4 | "version": "0.1.1", 5 | "author": "wes bos", 6 | "license": "MIT", 7 | "description": "Take a dump on your React App.", 8 | "main": "index.js", 9 | "scripts": { 10 | "build": "rollup -c" 11 | }, 12 | "dependencies": { 13 | "react": "16.11.0", 14 | "react-dom": "16.11.0" 15 | }, 16 | "devDependencies": { 17 | "@babel/cli": "7.6.4", 18 | "@babel/core": "7.6.4", 19 | "@babel/preset-env": "7.6.3", 20 | "@babel/preset-react": "7.6.3", 21 | "rollup": "1.25.2", 22 | "rollup-plugin-babel": "4.3.3" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/wesbos/dump.git" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/wesbos/dump/issues" 30 | }, 31 | "homepage": "https://github.com/wesbos/dump#readme", 32 | "keywords": [ 33 | "react", 34 | "dump", 35 | "props" 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Wes Bos 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { value: true }); 4 | 5 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 6 | 7 | var React = _interopDefault(require('react')); 8 | 9 | function _slicedToArray(arr, i) { 10 | return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); 11 | } 12 | 13 | function _arrayWithHoles(arr) { 14 | if (Array.isArray(arr)) return arr; 15 | } 16 | 17 | function _iterableToArrayLimit(arr, i) { 18 | if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { 19 | return; 20 | } 21 | 22 | var _arr = []; 23 | var _n = true; 24 | var _d = false; 25 | var _e = undefined; 26 | 27 | try { 28 | for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 29 | _arr.push(_s.value); 30 | 31 | if (i && _arr.length === i) break; 32 | } 33 | } catch (err) { 34 | _d = true; 35 | _e = err; 36 | } finally { 37 | try { 38 | if (!_n && _i["return"] != null) _i["return"](); 39 | } finally { 40 | if (_d) throw _e; 41 | } 42 | } 43 | 44 | return _arr; 45 | } 46 | 47 | function _nonIterableRest() { 48 | throw new TypeError("Invalid attempt to destructure non-iterable instance"); 49 | } 50 | 51 | var Dump = function Dump(props) { 52 | return React.createElement("div", { 53 | style: { 54 | fontSize: 20, 55 | border: '1px solid #efefef', 56 | padding: 10, 57 | background: 'white' 58 | } 59 | }, Object.entries(props).map(function (_ref) { 60 | var _ref2 = _slicedToArray(_ref, 2), 61 | key = _ref2[0], 62 | val = _ref2[1]; 63 | 64 | return React.createElement("pre", { 65 | key: key 66 | }, React.createElement("strong", { 67 | style: { 68 | color: 'white', 69 | background: 'red' 70 | } 71 | }, key, " \uD83D\uDCA9"), JSON.stringify(val, '', ' ')); 72 | })); 73 | }; 74 | 75 | exports.default = Dump; 76 | --------------------------------------------------------------------------------