Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "echo-best", | ||
"version": "1.0.1", | ||
"description": "The Echo Nest JavaScript API for RequireJS, Node, and browsers", | ||
"homepage": "https://github.com/mjhasbach/echo-best", | ||
"authors": [ | ||
"Matthew Hasbach <hasbach.git@gmail.com> (https://github.com/mjhasbach)" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mjhasbach/echo-best.git" | ||
}, | ||
"dependencies": { | ||
"bops": "https://github.com/chrisdickinson/bops.git", | ||
"lodash": "~3.2.0", | ||
"superagent": "https://github.com/visionmedia/superagent.git" | ||
}, | ||
"keywords": [ | ||
"echo", | ||
"nest", | ||
"javascript", | ||
"api", | ||
"browser", | ||
"node", | ||
"commonjs", | ||
"requirejs", | ||
"amd" | ||
] | ||
"name": "echo-best", | ||
"version": "1.0.2", | ||
"description": "The Echo Nest JavaScript API for RequireJS, Node, and browsers", | ||
"license": "MIT", | ||
"homepage": "https://github.com/mjhasbach/echo-best", | ||
"dependencies": { | ||
"bops": "https://github.com/chrisdickinson/bops.git", | ||
"lodash": "~3.2.0", | ||
"superagent": "https://github.com/visionmedia/superagent.git" | ||
}, | ||
"keywords": [ | ||
"echo", | ||
"nest", | ||
"javascript", | ||
"api", | ||
"browser", | ||
"node", | ||
"commonjs", | ||
"requirejs", | ||
"amd" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mjhasbach/echo-best.git" | ||
}, | ||
"authors": [ | ||
"Matthew Hasbach <hasbach.git@gmail.com> (https://github.com/mjhasbach)" | ||
] | ||
} |
console.log('Getting song info from the Echo Nest...'); | ||
require('../shared/getSongInfo')(function(err, res){ | ||
if (err){ throw err; } | ||
console.log(res); | ||
}); | ||
require('../shared/getSongInfo'); |
@@ -8,3 +8,3 @@ require.config({ | ||
'echo-best': '../../shared/node_modules/echo-best/lib/echoBest', | ||
'objectToDOM': '../../shared/objectToDOM', | ||
'varToDOM': '../../shared/node_modules/jquery-vartodom/lib/jquery-varToDOM', | ||
'getSongInfo': '../../shared/getSongInfo' | ||
@@ -14,2 +14,2 @@ } | ||
require(['requireGetSongInfo']); | ||
require(['getSongInfo']); |
@@ -1,24 +0,65 @@ | ||
(function (root, factory) { | ||
(function(root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(['echo-best'], factory); | ||
define(['jquery', 'lodash', 'echo-best', 'varToDOM'], factory); | ||
} else if (typeof exports === 'object') { | ||
module.exports = factory(require('echo-best')); | ||
var _$ = require('detect-node') ? null : require('jquery'); | ||
module.exports = factory(_$, require('lodash'), require('echo-best'), _$ ? require('jquery-vartodom') : null); | ||
} else { | ||
root.getSongInfo = factory(root.echoBest); | ||
root.getSongInfo = factory(root.$, root._, root.echoBest); | ||
} | ||
}(this, function(echoBest) { | ||
return function(cb){ | ||
if (typeof cb !== 'function'){ | ||
throw new TypeError('cb must be a function'); | ||
} | ||
}(this, function($, _, echoBest) { | ||
var $body = {}, | ||
getSongInfo = function() { | ||
echoBest('BLR1XMTZN2ZWCCATJ')( | ||
'song/profile', | ||
{ | ||
track_id: 'spotify:track:6Hqd8S0yliJnFKjJH0Qyed', | ||
bucket: 'audio_summary' | ||
}, | ||
function(err, res) { | ||
var songs = res.songs, | ||
song = _.isArray(songs) && _.isObject(songs[0]) ? songs[0] : null, | ||
invalidResponse = 'Error - Invalid response received'; | ||
echoBest('BLR1XMTZN2ZWCCATJ')( | ||
'song/profile', | ||
{ | ||
track_id: 'spotify:track:6Hqd8S0yliJnFKjJH0Qyed', | ||
bucket: 'audio_summary' | ||
}, | ||
cb | ||
); | ||
if (err) { | ||
console.error(err); | ||
} | ||
if ($) { | ||
$body.empty(); | ||
if (song) { | ||
$body.varToDOM({var: songs[0]}); | ||
} | ||
else { | ||
$body.append($('<div>').text(invalidResponse)); | ||
} | ||
} | ||
else{ | ||
if (song) { | ||
console.log(song); | ||
} | ||
else { | ||
console.error(invalidResponse); | ||
} | ||
} | ||
} | ||
); | ||
}; | ||
if ($) { | ||
$(function() { | ||
$body = $('body'); | ||
$body.append( | ||
$('<div>').text('Getting song info from the Echo Nest...') | ||
); | ||
getSongInfo(); | ||
}); | ||
} | ||
else { | ||
getSongInfo(); | ||
} | ||
})); |
@@ -6,6 +6,8 @@ { | ||
"dependencies": { | ||
"echo-best": "0.0.1", | ||
"jquery": "~1.11.2", | ||
"detect-node": "~2.0.3", | ||
"echo-best": "~1.0.1", | ||
"jquery": "~2.1.3", | ||
"jquery-vartodom": "~1.0.0", | ||
"requirejs": "~2.1.16" | ||
} | ||
} | ||
} |
{ | ||
"name": "echo-best", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "The Echo Nest JavaScript API for RequireJS, Node, and browsers", | ||
"main": "lib/echoBest.js", | ||
"license": "MIT", | ||
"directories": { | ||
"example": "examples", | ||
"lib": "lib" | ||
}, | ||
"homepage": "https://github.com/mjhasbach/echo-best", | ||
"dependencies": { | ||
@@ -40,5 +36,10 @@ "bops": "~0.1.1", | ||
}, | ||
"main": "lib/echoBest.js", | ||
"directories": { | ||
"example": "examples", | ||
"lib": "lib" | ||
}, | ||
"scripts": { | ||
"test": "mocha test" | ||
} | ||
} | ||
} |
@@ -33,2 +33,13 @@ # Why Another JavaScript API | ||
[Node Examples](https://github.com/mjhasbach/echo-best/tree/master/examples/node) | ||
[Node Examples](https://github.com/mjhasbach/echo-best/tree/master/examples/node) | ||
# Tests | ||
Before running the tests, Mocha must be installed: | ||
``` | ||
npm install -g mocha | ||
``` | ||
To run the tests: | ||
``` | ||
npm test | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
44
26531
18
559