@aknakos/sveltekit-danfojs
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Simple danfojs wrapper for svelte

Simple implementation of a wrapper for danfo.js which works with sveltekit. Normally, I'd prefer to build it within sveltekit, but as of now I was unable to do so. This library uses danfojs' CDN, which means all code which requires it will be CSR (and not SSR). I made this to easily reuse the logic, but feel free to copy the code in the .svelte file to customize however you want and/or if you don't want to install a dependency only for this.

You can use this library in a couple of ways. Usage 1:

//index.svelte
<script>
	import Danfojs from '@aknakos/sveltekit-danfojs/Danfojs.svelte';
	import Inner from './Inner.svelte';
</script>

<Danfojs let:dfd>
	<Inner {dfd} />
</Danfojs>

//Inner.svelte
<script>
	export let dfd;

	let s = new dfd.Series([1, 2, 3, 4, 5]);
	s.print();
</script>

Usage 2:

//index.svelte
<script>
	import Danfojs from '@aknakos/sveltekit-danfojs/Danfojs.svelte';
	import Inner from './Inner.svelte';
</script>

<Danfojs>
	<Inner />
</Danfojs>

//Inner.svelte
<script>
	import { dfd } from '@aknakos/sveltekit-danfojs/store.js';

	let s = new $dfd.Series([1, 2, 3, 4, 5]); // Note this is in a store format now
	s.print();
</script>

Package Sidebar

Install

npm i @aknakos/sveltekit-danfojs

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

4.53 kB

Total Files

10

Last publish

Collaborators

  • aknakos