Skip to content

Commit

Permalink
feat: export isDraftable
Browse files Browse the repository at this point in the history
For use by Immer-based libraries
  • Loading branch information
aleclarson committed Jan 22, 2019
1 parent d57433b commit c89d47d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/immer.d.ts
Expand Up @@ -157,9 +157,12 @@ export function applyPatches<S>(base: S, patches: Patch[]): S
/** Get the underlying object that is represented by the given draft */
export function original<T>(value: T): T | void

/** For detecting an Immer draft */
/** Returns true if the given value is an Immer draft */
export function isDraft(value: any): boolean

/** Returns true if the given value can be drafted by Immer */
export function isDraftable(value: any): boolean

export class Immer {
constructor(config: {
useProxies?: boolean
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -50,6 +50,7 @@ export const applyPatches = produce(applyPatchesImpl)
export {
original,
isDraft,
isDraftable,
NOTHING as nothing,
DRAFTABLE as immerable
} from "./common"
Expand Down

0 comments on commit c89d47d

Please sign in to comment.