Skip to content

Commit

Permalink
Update all isArray references to jQuery.isArray
Browse files Browse the repository at this point in the history
This removes Spine.isArray completely
  • Loading branch information
mattsta committed Jun 8, 2012
1 parent 5449124 commit 9e479cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/relation.coffee
@@ -1,5 +1,4 @@
Spine = @Spine or require('spine')
isArray = Spine.isArray
require = @require or ((value) -> eval(value))

class Collection extends Spine.Module
Expand Down Expand Up @@ -38,7 +37,7 @@ class Collection extends Spine.Module
delete @model.records[record.id] for record in @all()
records = @model.fromJSON(values)

records = [records] unless isArray(records)
records = [records] unless $.isArray(records)

for record in records
record.newRecord = false
Expand Down Expand Up @@ -141,4 +140,4 @@ Spine.Model.extend

@::[name] = (value) ->
association(@).update(value) if value?
association(@).find()
association(@).find()
10 changes: 3 additions & 7 deletions src/spine.coffee
Expand Up @@ -123,7 +123,7 @@ class Model extends Module
@crecords = {}

records = @fromJSON(values)
records = [records] unless isArray(records)
records = [records] unless $.isArray(records)

for record in records
record.id or= record.cid
Expand Down Expand Up @@ -203,7 +203,7 @@ class Model extends Module
return unless objects
if typeof objects is 'string'
objects = JSON.parse(objects)
if isArray(objects)
if $.isArray(objects)
(new @(value) for value in objects)
else
new @(objects)
Expand Down Expand Up @@ -486,9 +486,6 @@ createObject = Object.create or (o) ->
Func.prototype = o
new Func()

isArray = (value) ->
Object::toString.call(value) is '[object Array]'

isBlank = (value) ->
return true unless value
return false for key of value
Expand All @@ -503,7 +500,6 @@ Spine = @Spine = {}
module?.exports = Spine

Spine.version = '1.0.8'
Spine.isArray = isArray
Spine.isBlank = isBlank
Spine.$ = $
Spine.Events = Events
Expand Down Expand Up @@ -532,4 +528,4 @@ Model.setup = (name, attributes = []) ->
Instance.configure(name, attributes...)
Instance

Spine.Class = Module
Spine.Class = Module

0 comments on commit 9e479cc

Please sign in to comment.