1.2.13 • Published 4 years ago

djit v1.2.13

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

djit

Excel-like Javascript Object

Create an Excel-like object in Javascript that automagically computes itself whenever updated.

Basically a programitacally accessible Excel Spreadsheet.

Example:

import { djit } from 'djit'

const qdata = djit([[150, 33], [12.55, 'Yo!']])
/*
  qdata = {
    A1: { input: 150, type: 'integer', value: 150, listeners: [ 'A3' ] },
    B1: { input: 33, type: 'integer', value: 33 },
    A2: { input: 12.55, type: 'float', value: 12.55, listeners: [ 'A3' ] },
    B2: { input: 'Yo!', type: 'string', value: 'Yo!' }
  }
*/
qdata.toArray()
// [ [ 150, 33 ], [ 12.55, 'Yo!' ] ]

qdata.A3 = '=A1 + A2'
qdata.toArray()
// [ [ 150, 33 ], [ 12.55, 'Yo!' ], [ 162.55 ] ]

qdata.B3 = '=A3 / 6'
qdata.toArray()
// [ [ 150, 33 ], [ 12.55, 'Yo!' ], [ 162.55, 27.09166666666667 ] ]

console.log(qdata.B3) // 27.09166666666667

Installation and Usage

Add djit to your project:

$ yarn add djit

Import and initialize:

import { djit } from 'djit'

Create a new sheet object:

const data = [[], []]
const context = { Math }
// Math.* functions are available to be used in cells like so: `data.B1 = '=floor(random() * 100)'`

const onChange = (key, value, Data) => {
  console.log('Djit updated:', key, 'New value:', value)
}
// onChange will fire every time a cell value is updated

const qdata = djit(data, { context, onChange })

Interact with the data:

qdata.A1 = 100
qdata.B1 = 200
qdata.C1 = '=A1 + B1'

Explore data:

console.log('C1 cell:', qdata.C1) // 300

console.log('As array:', qdata.toArray()) // As array: [ [ 100, 200, 300 ] ]
1.2.13

4 years ago

1.2.12

4 years ago

1.2.11

4 years ago

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.33

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.27

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago