Skip to content

Commit

Permalink
expose get() from svelte/store (#2060)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Mar 1, 2019
1 parent 5459b71 commit 349a14a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion store.mjs
Original file line number Diff line number Diff line change
@@ -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 = [];
Expand Down Expand Up @@ -103,3 +103,5 @@ export function derive(stores, fn) {
};
});
}

export { get_store_value as get };
7 changes: 6 additions & 1 deletion test/store/index.js
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -171,5 +171,10 @@ describe('store', () => {

unsubscribe();
});

it('gets the current value of a store', () => {
const store = readable(() => {}, 42);
assert.equal(get(store), 42);
});
});
});

0 comments on commit 349a14a

Please sign in to comment.