Skip to content

Commit

Permalink
changed inputs from PascalCase to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
ebiwonjumit committed Jan 4, 2024
1 parent 2db7ad6 commit e0f2b00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
40 changes: 20 additions & 20 deletions src/procedures/music-app/music-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ MusicApp._getNamesBySoundType = async function (soundType = "") {

/**
* Get sounds based on query.
* @param {DrumPackName=} PackName
* @param {DrumOneShotTypes=} DrumType
* @param {DrumPackName=} packName
* @param {DrumOneShotTypes=} drumType
* @returns {String}
*/
MusicApp.getDrumOneShotNames = async function (
PackName = "",
DrumType = "",
packName = "",
drumType = "",
) {
var names = [];
let queriedJSON = "";

//Ensure at least one field is selected
if (PackName !== "" || DrumType !== "") {
if (packName !== "" || drumType !== "") {
queriedJSON = drumLibrary.drumSoundLibrary.filter(function (obj) { // Check if field value is empty before finding obj with value.
return (PackName === "" || obj.packName === PackName) &&
(DrumType === "" || obj.Instrument === DrumType);
return(packName === "" || obj.packName === packName) &&
(drumType === "" || obj.Instrument === drumType);
});
} else {
throw Error("At least one field must be selected");
Expand All @@ -79,28 +79,28 @@ MusicApp.getDrumOneShotNames = async function (

/**
* Get sounds based on query.
* @param {Chords=} Chords
* @param {Keys=} Key
* @param {BPM=} BPM
* @param {InstrumentNames=} InstrumentName
* @param {Chords=} chords
* @param {Keys=} key
* @param {BPM=} bpm
* @param {InstrumentNames=} instrumentName
* @returns {Array}
*/
MusicApp.getSoundNames = async function (
Chords = "",
Key = "",
BPM = "",
InstrumentName = "",
chords = "",
key = "",
bpm = "",
instrumentName = "",
) {
var names = [];
let queriedJSON = "";

//Ensure at least one field is selected
if (Chords !== "" || Key !== "" || BPM !== "" || InstrumentName !== "") {
if (chords !== "" || key !== "" || bpm !== "" || instrumentName !== "") {
queriedJSON = soundLibrary.netsbloxSoundLibrary.filter(function (obj) { // Check if field value is empty before finding obj with value.
return (InstrumentName === "" || obj.InstrumentName === InstrumentName) &&
(BPM === "" || obj.BPM === BPM) &&
(Key === "" || obj.Key === Key) &&
(Chords === "" || obj.ChordProgression === Chords);
return (instrumentName === "" || obj.InstrumentName === instrumentName) &&
(bpm === "" || obj.BPM === bpm) &&
(key === "" || obj.Key === key) &&
(chords === "" || obj.ChordProgression === chords);
});
} else {
throw Error("At least one field must be selected");
Expand Down
4 changes: 2 additions & 2 deletions test/procedures/music-app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ describe(utils.suiteName(__filename), function () {
let service, testSuite;

utils.verifyRPCInterfaces("MusicApp", [
["getSoundNames", ["Chords", "Key", "BPM", "InstrumentName"]],
["getSoundNames", ["chords", "key", "bpm", "instrumentName"]],
["nameToSound", ["nameOfSound"]],
["getDrumOneShotNames", ["PackName", "DrumType"]],
["getDrumOneShotNames", ["packName", "drumType"]],
]);

before(async () => {
Expand Down

0 comments on commit e0f2b00

Please sign in to comment.