Merge pull request #2145 from sveltejs/gh-2060

expose get() from svelte/store
pull/2153/head
Rich Harris 6 years ago committed by GitHub
commit 03f74c1505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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