expose get() from svelte/store (#2060)

pull/2145/head
Conduitry 6 years ago
parent 5459b71276
commit f6b3f38e89

@ -1,4 +1,4 @@
import { run_all, noop } from './internal';
import { run_all, noop, get_store_value } from './internal';
export function readable(start, value) {
const subscribers = [];
@ -103,3 +103,5 @@ export function derive(stores, fn) {
};
});
}
export { get_store_value as get };

@ -1,5 +1,5 @@
import * as assert from 'assert';
import { readable, writable, derive } from '../../store.js';
import { readable, writable, derive, get } from '../../store.js';
describe('store', () => {
describe('writable', () => {
@ -172,4 +172,11 @@ describe('store', () => {
unsubscribe();
});
});
describe('get', () => {
it('gets the current value of a store', () => {
const store = readable(() => {}, 42);
assert.equal(get(store), 42);
});
});
});

Loading…
Cancel
Save