Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Refactor all of the things #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### Description

<!-- Shortly describe the changes made -->

**Monday task:** MONDAY-<number>

<!-- Replace <number> with the item's number in Monday.com and it'll automagically turn into a link -->

<!-- ignore-task-list-start -->
<!--
### ToDo
If there are any tasks that need to be done prior to this PR being merged, write them here.
A bot will make sure that you've checked them all before allowing merging the PR
- [ ] task 1
-->
<!-- ignore-task-list-end -->

### Screenshot(s):

<!--
If relevant, it is helpful to include screenshots which help understand what changed. e.g. new feature / before / after

_before:_

_after:_

-->
27 changes: 27 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### Description

<!-- Sombody oh, you need some milk -->

**Monday task:** MONDAY-<number>

<!-- Replace <number> with the item's number in Monday.com and it'll automagically turn into a link -->

<!-- ignore-task-list-start -->
<!--
### ToDo
If there are any tasks that need to be done prior to this PR being merged, write them here.
A bot will make sure that you've checked them all before allowing merging the PR
- [ ] task 1
-->
<!-- ignore-task-list-end -->

### Screenshot(s):

<!--
If relevant, it is helpful to include screenshots which help understand what changed. e.g. new feature / before / after

_before:_

_after:_

-->
6 changes: 6 additions & 0 deletions shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class Rectangle {
}
}

class CircleGetsTheSquare {
constructor(circumference, radius) {
this.circumference = circumference
this.radius = radius
}

class Square extends Rectangle {
constructor(x) {
super(x, x)
Expand Down
41 changes: 41 additions & 0 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,47 @@ _.min = function(obj, iteratee, context) {
return result;
};

_.sampleThis = function(obj, n, guard) {
if (n == null || guard) {
if (!isArrayLike(obj)) obj = _.values(obj);
return obj[_.random(obj.length - 1)];
}
var sample = isArrayLike(obj) ? _.clone(obj) : _.values(obj);
var length = getLength(sample);
n = Math.max(Math.min(n, length), 0);
var last = length - 1;
for (var index = 0; index < n; index++) {
var rand = _.random(index, last);
var temp = sample[index];
sample[index] = sample[rand];
sample[rand] = temp;
}
return sample.slice(0, n);
};

_.sortBy = function(obj, iteratee, context) {
var index = 0;
iteratee = cb(iteratee, context);
return _.pluck(
_.map(obj, function(value, key, list) {
return {
value: value,
index: index++,
criteria: iteratee(value, key, list)
};
}).sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
}),
"value"
);
};

_.shuffle = function(obj) {
return _.sample(obj, Infinity);
};
Expand Down