New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

v-safe

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-safe

Vue.js directive to show text values from deep objects without any errors

0.2.0
latest
Source
npm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

v-safe

Vue.js directive to show text values from deep objects without any errors

Version Github file size Downloads Vue2 Say Thanks!

Why

This is meant to avoid this type of error when you are using deep objects, that usually can happen when you're expecting a deep object after a Promise

<span>{{ a.b.c.d }}</span>

[Vue warn]: Error in render: "TypeError: Cannot read property 'c' of undefined"

How to install

npm

$ npm install v-safe --save

yarn

$ yarn add v-safe

Quick start

Vue.js

You can import in you main.js file

import Vue from 'vue'
import VSafe from 'v-safe'

Vue.use(VSafe)

Nuxt.js

You can import as a Nuxt.js plugin

~/plugins/v-safe.js

import Vue from 'vue'
import VSafe from 'v-safe'

Vue.use(VSafe)

and then import it in your nuxt.config.js file

plugins: [
  '~/plugins/v-safe.js'
]

Basic usage

<template>
  <span v-safe="'a.b.c.d'"></span>
</template>

<script>
export default {
  data:() => ({
    a: {
      b: {
        c: {
          d: 'safe'
        }
      }
    }
  })
}
</script>

Development

contributions welcome

Fork the project and enter this commands in your terminal

git clone https://github.com/YOUR_GITHUB_USERNAME/v-safe.git
cd v-safe
yarn

License

MIT © guastallaigor

Keywords

vue.js

FAQs

Package last updated on 24 Apr 2019

Did you know?

Socket

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.

Install

Related posts