Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coffeescript-to-object

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffeescript-to-object

coffee-script string to object

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CoffeeScript To Object

Takes a string of coffee-script code and compiles it into an object containing fields starting with @ symbol.
For example, string @a = 5 returns {a: 5}.

TODO

  • handle functions
  • add source-map (for error column and line of coffee-script and not js)

Usage

var React = require('react')
var ReactDOM = require('react-dom')

var CoffeeScriptToObject = require('./CoffeeScriptToObject.jsx')

var App = React.createClass({
  getInitialState() {
    return {
      codeText: '',
      coffeeObject: {},
      errorMessage: '',
    }
    
  },

  render () {
    return (
      <div>
        <input
          value={this.state.codeText}
          onChange={(e)=>this.setState({codeText: e.target.value})}
        />

        <div>{JSON.stringify(this.state.coffeeObject)}</div>
        <div>{this.state.errorMessage}</div>

        <CoffeeScriptToObject
          codeText={this.state.codeText}
          onSuccess={(coffeeObject)=>this.setState({coffeeObject, errorMessage: ''})}
          onError={(error)=>this.setState({errorMessage: error.message})}
        />
      </div>
    )
  }
})

ReactDOM.render(<App />, document.getElementById('app'))

FAQs

Package last updated on 20 Nov 2016

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