Skip to content

Commit

Permalink
Removing utils
Browse files Browse the repository at this point in the history
  • Loading branch information
goatslacker committed Oct 17, 2015
1 parent 730db95 commit 0844b3a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/alt/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fn from '../../utils/functions'
import * as fn from '../functions'
import * as utils from '../utils/AltUtils'
import isPromise from 'is-promise'

Expand Down
30 changes: 30 additions & 0 deletions src/alt/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export const isFunction = x => typeof x === 'function'

export function isPojo(target) {
const Ctor = target.constructor

return (
!!target
&&
typeof target === 'object'
&&
Object.prototype.toString.call(target) === '[object Object]'
&&
isFunction(Ctor)
&&
(Ctor instanceof Ctor || target.type === 'AltStore')
)
}

export function eachObject(f, o) {
o.forEach((from) => {
Object.keys(Object(from)).forEach((key) => {
f(key, from[key])
})
})
}

export function assign(target, ...source) {
eachObject((key, value) => target[key] = value, source)
return target
}
2 changes: 1 addition & 1 deletion src/alt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Dispatcher } from 'flux'

import * as StateFunctions from './utils/StateFunctions'
import * as fn from '../utils/functions'
import * as fn from './functions'
import * as store from './store'
import * as utils from './utils/AltUtils'
import makeAction from './actions'
Expand Down
2 changes: 1 addition & 1 deletion src/alt/store/AltStore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fn from '../../utils/functions'
import * as fn from '../functions'
import transmitter from 'transmitter'

class AltStore {
Expand Down
2 changes: 1 addition & 1 deletion src/alt/store/StoreMixin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import transmitter from 'transmitter'
import * as fn from '../../utils/functions'
import * as fn from '../functions'

const StoreMixin = {
waitFor(...sources) {
Expand Down
2 changes: 1 addition & 1 deletion src/alt/store/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as utils from '../utils/AltUtils'
import * as fn from '../../utils/functions'
import * as fn from '../functions'
import AltStore from './AltStore'
import StoreMixin from './StoreMixin'

Expand Down
2 changes: 1 addition & 1 deletion src/alt/utils/AltUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fn from '../../utils/functions'
import * as fn from '../functions'

/*eslint-disable*/
const builtIns = Object.getOwnPropertyNames(NoopClass)
Expand Down
2 changes: 1 addition & 1 deletion src/alt/utils/StateFunctions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fn from '../../utils/functions'
import * as fn from '../functions'

export function setAppState(instance, data, onStore) {
const obj = instance.deserialize(data)
Expand Down

0 comments on commit 0844b3a

Please sign in to comment.