All Projects → micheleriva → Mjn

micheleriva / Mjn

Licence: mit
⚡️Like loadash.get, but in ~200 bytes

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
js
455 projects

Projects that are alternatives of or similar to Mjn

Graphql Errors
Simple error handler for GraphQL Ruby ❗️
Stars: ✭ 170 (+146.38%)
Mutual labels:  error-handling, exception-handling
Panic Overlay
Displays JS errors in browsers. Shows sources. Use with any framework. 💥✨
Stars: ✭ 50 (-27.54%)
Mutual labels:  error-handling, vanilla-js
Exceptions4c
🐑 An exception handling framework for C
Stars: ✭ 189 (+173.91%)
Mutual labels:  error-handling, exception-handling
cakephp-error-email
ErrorEmail Plugin for CakePHP3.x
Stars: ✭ 16 (-76.81%)
Mutual labels:  error-handling, exception-handling
Bugsnag React Native
Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
Stars: ✭ 374 (+442.03%)
Mutual labels:  error-handling, exception-handling
Stacktracey
Parses call stacks. Reads sources. Clean & filtered output. Sourcemaps. Node & browsers.
Stars: ✭ 115 (+66.67%)
Mutual labels:  error-handling, exception-handling
catchr
catchr: Flexible, useful tools for dealing with conditions in R, for new users and veterans
Stars: ✭ 17 (-75.36%)
Mutual labels:  error-handling, exception-handling
Faux Pas
A library that simplifies error handling for Functional Programming in Java
Stars: ✭ 100 (+44.93%)
Mutual labels:  error-handling, exception-handling
react-error-guard
⚛️An overlay for displaying stack frames based on create-react-app/packages/react-error-overlay
Stars: ✭ 18 (-73.91%)
Mutual labels:  error-handling, exception-handling
ignition-stackoverflow
An Ignition tab that fetches StackOverflow questions and provides a searchbar.
Stars: ✭ 74 (+7.25%)
Mutual labels:  error-handling, exception-handling
bugsnag-java
Bugsnag error reporting for Java.
Stars: ✭ 51 (-26.09%)
Mutual labels:  error-handling, exception-handling
Traceback with variables
Adds variables to python traceback. Simple, lightweight, controllable. Debug reasons of exceptions by logging or pretty printing colorful variable contexts for each frame in a stacktrace, showing every value. Dump locals environments after errors to console, files, and loggers. Works in Jupyter and IPython. Install with pip or conda.
Stars: ✭ 509 (+637.68%)
Mutual labels:  error-handling, exception-handling
Bugsnag Php
Bugsnag error monitoring and crash reporting tool for PHP apps
Stars: ✭ 475 (+588.41%)
Mutual labels:  error-handling, exception-handling
Bugsnag Js
Javascript error handling tool for Bugsnag. Monitor and report JavaScript bugs & errors.
Stars: ✭ 625 (+805.8%)
Mutual labels:  error-handling, exception-handling
Masonry Layout
An efficient and fast web component that gives you a beautiful masonry layout
Stars: ✭ 43 (-37.68%)
Mutual labels:  vanilla-js
Searcher
Query Search Portals from R
Stars: ✭ 59 (-14.49%)
Mutual labels:  error-handling
Bugsnag Android Ndk
DEPRECATED - this project now lives at bugsnag/bugsnag-android
Stars: ✭ 42 (-39.13%)
Mutual labels:  error-handling
Vanilla Ui Router
Simple vanilla JavaScript router
Stars: ✭ 42 (-39.13%)
Mutual labels:  vanilla-js
Life Calendar
📆 Online calendar of your Life in Weeks.
Stars: ✭ 62 (-10.14%)
Mutual labels:  vanilla-js
Fine Uploader
Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.
Stars: ✭ 8,158 (+11723.19%)
Mutual labels:  vanilla-js
Simple utility to check if a key or a value exists in an object.

Build Status Coverage Maintainability npm
Blazing Fast




No cannot get property x of undefined. Just returns void 0 (undefined) if a value or a key does not exist. Highly inspired from Java's Optional Type.

Index

Installation

yarn

yarn add mjn

npm

npm install --save mjn

cdn

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dist.min.js"></script>

Usage

Simple Example

import maybe from "mjn"; // Or import the library as you wish using npm or CDN script tag!

const myObject = {
  user: {
    name: "John",
    surname: "Doe",
    birthday: "1995-01-29",
    contacts: {
      email: "[email protected]",
      phone: "000 0000000"
    },
    languages: ["english", "italian"]
  }
};

const a = maybe(myObject, "user.name");
const b = maybe(myObject, "user.languages[1]");
const c = maybe(myObject, "foo.bar.baz");
const d = maybe(myObject, "foo.bar.baz", "no value!");
const e = maybe(myObject, "foo.bar.baz", () => "I can be a function!");


console.log(a); // => John
console.log(b); // => italian
console.log(c); // => won't log anything!
console.log(d); // => "no value!"
console.log(e); // => "I can be a function!"

Real World React Example

import React from "react";
import ReactDOM from "react-dom";
import maybe from "mjn";

const user = {
  name: {
    first_name: "John",
    last_name: "Doe"
  },
  contacts: {
    phone: "+00 000 0000000",
    email: "[email protected]"
  }
};

const App = () => (
  <div className="App">
    <h1>Hello {maybe(user, "name.first_name")}!</h1>
    <h2> {maybe(user, "contacts.email")} </h2>

    <p>
      {maybe(user, "contacts.phone.office", "You don't have an office phone.")}
    </p>
  </div>
);

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Demos

React.js

React Example Edit l71m022x99

Vue.js

Vue Example Edit Vue Template

Vanilla JS

Vanilla JS Vanilla JS

Contributors ✨

Thanks goes to these wonderful people (emoji key):

💼
Paolo Roth

💻
🎨

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].