-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.js
34 lines (28 loc) · 1010 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module.exports = Account
var events = require('./lib/events')
var getState = require('./utils/get-state')
function Account (options) {
if (!(this instanceof Account)) {
return new Account(options)
}
var state = getState(options)
var api = {
signUp: require('./lib/sign-up').bind(null, state),
signIn: require('./lib/sign-in').bind(null, state),
signOut: require('./lib/sign-out').bind(null, state),
destroy: require('./lib/destroy').bind(null, state),
get: require('./lib/get').bind(null, state),
update: require('./lib/update').bind(null, state),
profile: {
get: require('./lib/profile-get').bind(null, state),
update: require('./lib/profile-update').bind(null, state)
},
request: require('./lib/request').bind(null, state),
on: events.on.bind(null, state),
one: events.one.bind(null, state),
off: events.off.bind(null, state),
hook: state.hook.api,
validate: require('./lib/validate').bind(null, state)
}
return api
}