Socket
Socket
Sign inDemoInstall

evaljson

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evaljson

Eval embedded value in json. Useful to define message resource object.


Version published
Weekly downloads
473
decreased by-20.24%
Maintainers
1
Weekly downloads
 
Created
Source

evaljson

Build Status npm Version JS Standard

Eval embedded value in json. Useful to define message resource object.

Installation

npm install evaljson --save

Usage

'use strict'

const evaljson = require('evaljson')

let locale = evaljson({
  keys: {
    NAME: 'My Awesome App'
  },
  titles: {
    WELCOME_TITLE: 'Welcome to #{keys.NAME}!', // Embed value with "#{some_value}" syntax.
    WHERE_WE_ARE: 'We are on $(hostname)' // Execute command with "$(command)" syntax

  }
  /* ... */
})

console.log(locale.titles.WELCOME_TITLE) // -> Welcome to My Awesome App!

API

SignatureDescription
evaljson(src)Eval src, with self values as context.
evaljson(src, context)Eval with self values with context.

License

This software is released under the MIT License.

FAQs

Package last updated on 24 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc