Skip to content

Commit acaf0f1

Browse files
remove default limit. closes #64.
1 parent 49cc211 commit acaf0f1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/instafeed.coffee

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class Instafeed
77
resolution: 'thumbnail'
88
sortBy: 'most-recent'
99
links: true
10-
limit: 15
1110
mock: false
1211
useHttp: false
1312

@@ -150,7 +149,8 @@ class Instafeed
150149
if document? and @options.mock is false
151150
# limit the number of images if needed
152151
images = response.data
153-
images = images[0..@options.limit] if images.length > @options.limit
152+
if @options.limit?
153+
images = images[0..@options.limit] if images.length > @options.limit
154154

155155
# create the document fragment
156156
fragment = document.createDocumentFragment()
@@ -289,7 +289,8 @@ class Instafeed
289289
final += "?client_id=#{@options.clientId}"
290290

291291
# add the count limit
292-
final += "&count=#{@options.limit}"
292+
if @options.limit?
293+
final += "&count=#{@options.limit}"
293294

294295
# add the jsonp callback
295296
final += "&callback=instafeedCache#{@unique}.parse"

test/instafeedTest.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ describe 'Instafeed instace', ->
6464
it 'should assemble a url using the client id', ->
6565
feed = new Instafeed
6666
clientId: 'test'
67-
feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?client_id=test&count=15&callback=instafeedCache#{feed.unique}.parse"
67+
feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?client_id=test&callback=instafeedCache#{feed.unique}.parse"
6868

6969
it 'should use the access token for authentication, when available', ->
7070
feed = new Instafeed
7171
clientId: 'test'
7272
accessToken: 'mytoken'
73-
feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?access_token=mytoken&count=15&callback=instafeedCache#{feed.unique}.parse"
73+
feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?access_token=mytoken&callback=instafeedCache#{feed.unique}.parse"
7474

7575
it 'should refuse to build a url with invalid "get" option', ->
7676
feed = new Instafeed

0 commit comments

Comments
 (0)