Merge pull request #262 from aldraco/bonfirelinks
Bonfire MDN links - Issue #255
This commit is contained in:
@ -2,7 +2,8 @@ var _ = require('lodash'),
|
|||||||
debug = require('debug')('freecc:cntr:bonfires'),
|
debug = require('debug')('freecc:cntr:bonfires'),
|
||||||
Bonfire = require('./../models/Bonfire'),
|
Bonfire = require('./../models/Bonfire'),
|
||||||
User = require('./../models/User'),
|
User = require('./../models/User'),
|
||||||
resources = require('./resources');
|
resources = require('./resources'),
|
||||||
|
MDNlinks = require('./../seed_data/bonfireMDNlinks');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bonfire controller
|
* Bonfire controller
|
||||||
@ -110,7 +111,9 @@ exports.returnIndividualBonfire = function(req, res, next) {
|
|||||||
phrase: resources.randomPhrase(),
|
phrase: resources.randomPhrase(),
|
||||||
compliment: resources.randomCompliment(),
|
compliment: resources.randomCompliment(),
|
||||||
bonfires: bonfire,
|
bonfires: bonfire,
|
||||||
bonfireHash: bonfire._id
|
bonfireHash: bonfire._id,
|
||||||
|
MDNkeys: bonfire.MDNlinks,
|
||||||
|
MDNlinks: getMDNlinks(bonfire.MDNlinks)
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -147,6 +150,23 @@ function randomString() {
|
|||||||
return randomstring;
|
return randomstring;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to populate the MDN links array.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getMDNlinks(links) {
|
||||||
|
// takes in an array of links, which are strings
|
||||||
|
var populatedLinks = [];
|
||||||
|
|
||||||
|
// for each key value, push the corresponding link from the MDNlinks object into a new array
|
||||||
|
links.forEach(function(value, index) {
|
||||||
|
populatedLinks.push(MDNlinks[value]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return populatedLinks;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,8 @@ var bonfireSchema = new mongoose.Schema({
|
|||||||
difficulty: String,
|
difficulty: String,
|
||||||
description: Array,
|
description: Array,
|
||||||
tests: Array,
|
tests: Array,
|
||||||
challengeSeed: String
|
challengeSeed: String,
|
||||||
|
MDNlinks: [String]
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = mongoose.model('Bonfire', bonfireSchema);
|
module.exports = mongoose.model('Bonfire', bonfireSchema);
|
||||||
|
66
seed_data/bonfireMDNlinks.js
Normal file
66
seed_data/bonfireMDNlinks.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// MDN Links
|
||||||
|
|
||||||
|
/* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links.
|
||||||
|
|
||||||
|
|
||||||
|
The text of the key is what the link text will be, e.g. <a href="https://developer ...">Global Array Object</a>
|
||||||
|
General convention is to use the page title of the MDN reference page.
|
||||||
|
*/
|
||||||
|
var links =
|
||||||
|
{
|
||||||
|
// ========= GLOBAL OBJECTS
|
||||||
|
"Global Array Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||||
|
"Global Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
|
||||||
|
"Global String Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||||
|
"Boolean Objects" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
|
||||||
|
|
||||||
|
// ========= PROPERTIES/MISC
|
||||||
|
"String.length" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length",
|
||||||
|
"Arguments object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments",
|
||||||
|
|
||||||
|
// ========== OBJECT METHODS
|
||||||
|
"Object.getOwnPropertyNames()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames",
|
||||||
|
"Object.keys()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys",
|
||||||
|
"Object.hasOwnProperty()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty",
|
||||||
|
|
||||||
|
|
||||||
|
// ======== STRING METHODS
|
||||||
|
"String.charAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt",
|
||||||
|
"String.charCodeAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt",
|
||||||
|
"String.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat",
|
||||||
|
"String.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf",
|
||||||
|
"String.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf",
|
||||||
|
"String.match()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match",
|
||||||
|
"String.replace()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace",
|
||||||
|
"String.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice",
|
||||||
|
"String.split()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split",
|
||||||
|
"String.substring()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring",
|
||||||
|
"String.substr()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr",
|
||||||
|
"String.toLowerCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase",
|
||||||
|
"String.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString",
|
||||||
|
"String.toUpperCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase",
|
||||||
|
// ======== ARRAY METHODS
|
||||||
|
"Array.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
|
||||||
|
"Array.every()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every",
|
||||||
|
"Array.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter",
|
||||||
|
"Array.forEach()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach",
|
||||||
|
"Array.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf",
|
||||||
|
"Array.join()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join",
|
||||||
|
"Array.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf",
|
||||||
|
"Array.map()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map",
|
||||||
|
"Array.pop()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop",
|
||||||
|
"Array.push()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push",
|
||||||
|
"Array.reduce()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce",
|
||||||
|
"Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse",
|
||||||
|
"Array.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice",
|
||||||
|
"Array.some()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some",
|
||||||
|
"Array.sort()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort",
|
||||||
|
"Array.splice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice",
|
||||||
|
"Array.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString",
|
||||||
|
|
||||||
|
// ======== GENERAL JAVASCRIPT REFERENCES
|
||||||
|
"Arithmetic Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators",
|
||||||
|
"Comparison Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators"
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = links;
|
@ -31,7 +31,8 @@
|
|||||||
"You may need to turn the string into an array before you can reverse it.",
|
"You may need to turn the string into an array before you can reverse it.",
|
||||||
"Your result must be a string."
|
"Your result must be a string."
|
||||||
],
|
],
|
||||||
"challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');"
|
"challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');",
|
||||||
|
"MDNlinks" : ["Global String Object", "String.split()", "Array.reverse()", "Array.join()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a302f7aae1aa3152a5b413bc",
|
"_id": "a302f7aae1aa3152a5b413bc",
|
||||||
@ -49,7 +50,8 @@
|
|||||||
"Factorials are often represented with the shorthand notation n!",
|
"Factorials are often represented with the shorthand notation n!",
|
||||||
"For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f"
|
"For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f"
|
||||||
],
|
],
|
||||||
"challengeSeed": "function factorialize(num) {\n return num;\r\n}\n\nfactorialize(5);"
|
"challengeSeed": "function factorialize(num) {\n return num;\r\n}\n\nfactorialize(5);",
|
||||||
|
"MDNlinks" : ["Arithmetic Operators"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "aaa48de84e1ecc7c742e1124",
|
"_id": "aaa48de84e1ecc7c742e1124",
|
||||||
@ -70,7 +72,8 @@
|
|||||||
"assert.deepEqual(palindrome(\"never odd or even\"), true);",
|
"assert.deepEqual(palindrome(\"never odd or even\"), true);",
|
||||||
"assert.deepEqual(palindrome(\"nope\"), false);"
|
"assert.deepEqual(palindrome(\"nope\"), false);"
|
||||||
],
|
],
|
||||||
"challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n\n\npalindrome(\"eye\");"
|
"challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n\n\npalindrome(\"eye\");",
|
||||||
|
"MDNlinks" : ["String.replace()", "String.toLowerCase()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a26cbbe9ad8655a977e1ceb5",
|
"_id": "a26cbbe9ad8655a977e1ceb5",
|
||||||
@ -87,7 +90,8 @@
|
|||||||
"expect(findLongestWord('May the force be with you')).to.equal(5);",
|
"expect(findLongestWord('May the force be with you')).to.equal(5);",
|
||||||
"expect(findLongestWord('Google do a barrel roll')).to.equal(6);",
|
"expect(findLongestWord('Google do a barrel roll')).to.equal(6);",
|
||||||
"expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);"
|
"expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.split()", "String.length"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "ab6137d4e35944e21037b769",
|
"_id": "ab6137d4e35944e21037b769",
|
||||||
@ -103,7 +107,8 @@
|
|||||||
"expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");",
|
"expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");",
|
||||||
"expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");",
|
"expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");",
|
||||||
"expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");"
|
"expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.charAt()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a789b3483989747d63b0e427",
|
"_id": "a789b3483989747d63b0e427",
|
||||||
@ -119,7 +124,8 @@
|
|||||||
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
|
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
|
||||||
"(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);",
|
"(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);",
|
||||||
"assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));"
|
"assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Comparison Operators"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "acda2fb1324d9b0fa741e6b5",
|
"_id": "acda2fb1324d9b0fa741e6b5",
|
||||||
@ -134,7 +140,8 @@
|
|||||||
"assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');",
|
"assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');",
|
||||||
"assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');",
|
"assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');",
|
||||||
"assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');"
|
"assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.substr()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "afcc8d540bea9ea2669306b6",
|
"_id": "afcc8d540bea9ea2669306b6",
|
||||||
@ -148,7 +155,8 @@
|
|||||||
"assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');",
|
"assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');",
|
||||||
"assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');",
|
"assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');",
|
||||||
"assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');"
|
"assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Global String Object"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "ac6993d51946422351508a41",
|
"_id": "ac6993d51946422351508a41",
|
||||||
@ -163,7 +171,8 @@
|
|||||||
"expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');",
|
"expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');",
|
||||||
"assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');",
|
"assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');",
|
||||||
"assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');"
|
"assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.slice()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a9bd25c716030ec90084d8a1",
|
"_id": "a9bd25c716030ec90084d8a1",
|
||||||
@ -177,7 +186,8 @@
|
|||||||
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
|
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
|
||||||
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
|
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
|
||||||
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');"
|
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.push()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "ab31c21b530c0dafa9e241ee",
|
"_id": "ab31c21b530c0dafa9e241ee",
|
||||||
@ -191,7 +201,8 @@
|
|||||||
"assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');",
|
"assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');",
|
||||||
"assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');",
|
"assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');",
|
||||||
"assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');"
|
"assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.slice()", "Array.splice()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "af2170cad53daa0770fabdea",
|
"_id": "af2170cad53daa0770fabdea",
|
||||||
@ -210,7 +221,8 @@
|
|||||||
"expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;",
|
"expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;",
|
||||||
"expect(mutation(['Mary', 'Army'])).to.be.true;",
|
"expect(mutation(['Mary', 'Army'])).to.be.true;",
|
||||||
"expect(mutation(['Alien', 'line'])).to.be.true;"
|
"expect(mutation(['Alien', 'line'])).to.be.true;"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.sort()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "adf08ec01beb4f99fc7a68f2",
|
"_id": "adf08ec01beb4f99fc7a68f2",
|
||||||
@ -225,7 +237,8 @@
|
|||||||
"assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');",
|
"assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');",
|
||||||
"assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');",
|
"assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');",
|
||||||
"assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');"
|
"assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Boolean Objects", "Array.filter()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id":"a8e512fbe388ac2f9198f0fa",
|
"_id":"a8e512fbe388ac2f9198f0fa",
|
||||||
@ -238,7 +251,8 @@
|
|||||||
"tests":[
|
"tests":[
|
||||||
"assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');",
|
"assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');",
|
||||||
"assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');"
|
"assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Global Object", "Object.hasOwnProperty()", "Object.keys()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id":"a39963a4c10bc8b4d4f06d7e",
|
"_id":"a39963a4c10bc8b4d4f06d7e",
|
||||||
@ -251,7 +265,8 @@
|
|||||||
"tests": [
|
"tests": [
|
||||||
"assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');",
|
"assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');",
|
||||||
"assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');"
|
"assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.filter()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a24c1a4622e3c05097f71d67",
|
"_id": "a24c1a4622e3c05097f71d67",
|
||||||
|
@ -73,9 +73,14 @@ block content
|
|||||||
.col-xs-12
|
.col-xs-12
|
||||||
for sentence in details
|
for sentence in details
|
||||||
p!= sentence
|
p!= sentence
|
||||||
|
#MDN-links
|
||||||
|
h4 Here are some helpful links.
|
||||||
|
for link, index in MDNlinks
|
||||||
|
ul: li: a(href=""+link, target="_blank") !{MDNkeys[index]}
|
||||||
#less-info.btn.btn-primary.btn-block.btn-primary-ghost
|
#less-info.btn.btn-primary.btn-block.btn-primary-ghost
|
||||||
span.ion-arrow-up-b
|
span.ion-arrow-up-b
|
||||||
| Less information
|
| Less information
|
||||||
|
|
||||||
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||||
br
|
br
|
||||||
form.code
|
form.code
|
||||||
@ -92,6 +97,7 @@ block content
|
|||||||
var started = Math.floor(Date.now() / 1000);
|
var started = Math.floor(Date.now() / 1000);
|
||||||
var _ = R;
|
var _ = R;
|
||||||
var dashed = !{JSON.stringify(dashedName)};
|
var dashed = !{JSON.stringify(dashedName)};
|
||||||
|
|
||||||
.col-xs-12.col-sm-12.col-md-8
|
.col-xs-12.col-sm-12.col-md-8
|
||||||
#mainEditorPanel
|
#mainEditorPanel
|
||||||
form.code
|
form.code
|
||||||
@ -143,5 +149,9 @@ block content
|
|||||||
$('.btn-twitter').attr('href', url);
|
$('.btn-twitter').attr('href', url);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||||
|
if (!MDNlinks.length) {
|
||||||
|
$('#MDN-links').addClass('collapse');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user