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

stencila-js

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stencila-js - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "stencila-js",
"version": "0.2.0",
"version": "0.2.1",
"description": "Stencila components for Javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -25,26 +25,22 @@ ## `stencila/js` : Stencila for Javascript

```js
# Create a session
// Create a session
let session = new JsSession()
# Evaluate an expression...
// Evaluate an expression...
session.execute('6*7') // { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
session.execute('6*7') # { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
// Output is the value of the last line
session.execute('let x = 6\nx*7') // { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
# Output is the value of the last line,
// If the last line is blank there is no output
// (this is intended for code chunks that have side effects e.g. set up data)
session.execute('let x = 6\nx*7\n\n') // { errors: {}, output: null }
session.execute('let x = 6\nx*7') # { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
// You can specify input variables (that are local to that call) as a data pack
session.execute('Math.PI*radius', {radius: pack(21.4)}) // { errors: {}, output: { type: 'flt', format: 'text', value: '67.23008278682157' } }
session.execute('radius') // { errors: { '1': 'ReferenceError: radius is not defined' }, output: null }
# If the last line is blank there is no output (this is intended for code chunks that have side effects e.g. set up data),
session.execute('let x = 6\nx*7\n\n') # { errors: {}, output: null }
# You can specify input variables (that are local to that call) as a data pack,
session.execute('Math.PI*radius', {radius:pack(21.4)}) # { errors: {}, output: { type: 'flt', format: 'text', value: '67.23008278682157' } }
session.execute('radius') # { errors: { '1': 'ReferenceError: radius is not defined' }, output: null }
# You can also assign global variables which are available in subsequent calls,
session.execute('globals.foo = "bar"\n\n') # { errors: {}, output: null }
session.execute('foo') # { errors: {}, output: { type: 'str', format: 'text', value: 'bar' } }
// You can also assign global variables which are available in subsequent calls
session.execute('globals.foo = "bar"\n\n') // { errors: {}, output: null }
session.execute('foo') // { errors: {}, output: { type: 'str', format: 'text', value: 'bar' } }
```

@@ -51,0 +47,0 @@

@@ -28,23 +28,18 @@ const {pack, unpack} = require('./packing')

*
* # Evaluate an expression...
* // Evaluate an expression...
* session.execute('6*7') // { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
*
* session.execute('6*7') # { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
* // Output is the value of the last line,
* session.execute('let x = 6\nx*7') // { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
*
* # Output is the value of the last line,
* // If the last line is blank there is no output (this is intended for code chunks that have side effects e.g. set up data),
* session.execute('let x = 6\nx*7\n\n') // { errors: {}, output: null }
*
* session.execute('let x = 6\nx*7') # { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
* // You can specify input variables (that are local to that call),
* session.execute('Math.PI*radius', {radius:{type:'flt', format:'text', value: '21.4'}}) // { errors: {}, output: { type: 'flt', format: 'text', value: '67.23008278682157' } }
* session.execute('radius') // { errors: { '1': 'ReferenceError: radius is not defined' }, output: null }
*
* # If the last line is blank there is no output (this is intended for code chunks that have side effects e.g. set up data),
*
* session.execute('let x = 6\nx*7\n\n') # { errors: {}, output: null }
*
* # You can specify input variables (that are local to that call),
*
* session.execute('Math.PI*radius', {radius:{type:'flt', format:'text', value: '21.4'}}) # { errors: {}, output: { type: 'flt', format: 'text', value: '67.23008278682157' } }
* session.execute('radius') # { errors: { '1': 'ReferenceError: radius is not defined' }, output: null }
*
* # You can also assign global variables which are available in subsequent calls,
*
* session.execute('globals.foo = "bar"\n\n') # { errors: {}, output: null }
* session.execute('foo') # { errors: {}, output: { type: 'str', format: 'text', value: 'bar' } }
* // You can also assign global variables which are available in subsequent calls,
* session.execute('globals.foo = "bar"\n\n') // { errors: {}, output: null }
* session.execute('foo') // { errors: {}, output: { type: 'str', format: 'text', value: 'bar' } }
*/

@@ -51,0 +46,0 @@ execute (code, inputs) {

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