Skip to content

Commit 79dc158

Browse files
feat(overmind): change derived to derive and computed to compute
BREAKING CHANGE: changed derived to derive and computed to compute
1 parent 6a077b3 commit 79dc158

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

packages/node_modules/overmind/src/computed.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import App, { computed } from './'
1+
import App, { compute } from './'
22

33
describe('Computed', () => {
44
test('should instantiate app with computed', () => {
@@ -8,7 +8,7 @@ describe('Computed', () => {
88
}
99
const state: State = {
1010
foo: 'bar',
11-
test: computed((foo: number) => (state: State) => state.foo + foo),
11+
test: compute((foo: number) => (state: State) => state.foo + foo),
1212
}
1313
const app = new App({
1414
state,
@@ -23,7 +23,7 @@ describe('Computed', () => {
2323
}
2424
const state: State = {
2525
foo: 'bar',
26-
test: computed((foo: number) => (state: State) => {
26+
test: compute((foo: number) => (state: State) => {
2727
runCount++
2828
return state.foo + foo
2929
}),
@@ -43,7 +43,7 @@ describe('Computed', () => {
4343
}
4444
const state: State = {
4545
foo: 'bar',
46-
test: computed((foo: number) => (state: State) => {
46+
test: compute((foo: number) => (state: State) => {
4747
runCount++
4848
return state.foo + foo
4949
}),
@@ -63,7 +63,7 @@ describe('Computed', () => {
6363
}
6464
const state: State = {
6565
foo: 'bar',
66-
test: computed((foo: number) => (state: State) => {
66+
test: compute((foo: number) => (state: State) => {
6767
runCount++
6868
return state.foo + foo
6969
}),
@@ -87,7 +87,7 @@ describe('Computed', () => {
8787
}
8888
const state: State = {
8989
foo: 'bar',
90-
test: computed(
90+
test: compute(
9191
(foo: number) => (state: State) => {
9292
runCount++
9393
return state.foo + foo

packages/node_modules/overmind/src/computed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class Computed {
9494
}
9595
}
9696

97-
export default function computed<Config, NewValue>(
97+
export default function compute<Config, NewValue>(
9898
cb: (config: Config) => (state: object) => NewValue,
9999
options?: ComputedOptions
100100
): (config: Config) => NewValue {

packages/node_modules/overmind/src/derived.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import App, { derived } from './'
1+
import App, { derive } from './'
22

33
type State = {
44
foo: string
@@ -10,7 +10,7 @@ describe('Derived', () => {
1010
const app = new App({
1111
state: {
1212
foo: 'bar',
13-
upperFoo: derived((state: State) => state.foo.toUpperCase()),
13+
upperFoo: derive((state: State) => state.foo.toUpperCase()),
1414
},
1515
})
1616
expect(app.state.upperFoo).toEqual('BAR')
@@ -20,7 +20,7 @@ describe('Derived', () => {
2020
const app = new App({
2121
state: {
2222
foo: 'bar',
23-
upperFoo: derived((state: State) => state.foo.toUpperCase()),
23+
upperFoo: derive((state: State) => state.foo.toUpperCase()),
2424
},
2525
actions: (action) => ({
2626
changeFoo: action().mutation((state) => (state.foo = 'bar2')),

packages/node_modules/overmind/src/derived.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Derived {
5959
}
6060
}
6161

62-
export default function derived<NewValue>(
62+
export default function derive<NewValue>(
6363
cb: (state: object) => NewValue
6464
): NewValue {
6565
return (new Derived(cb) as any) as NewValue

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import Devtools, { Message, safeValue } from './Devtools'
55
import Action, { IValueAction, INoValueAction } from './Action'
66
import Reaction, { ReactionConfig } from './reaction'
77
export { default as namespaces, Namespace } from './namespaces'
8-
export { default as derived } from './derived'
9-
export { default as computed } from './computed'
8+
export { default as derive } from './derived'
9+
export { default as compute } from './computed'
1010

1111
type Configuration<State, Effects, Actions, Reactions> = {
1212
state?: State

0 commit comments

Comments
 (0)