Git Product home page Git Product logo

absurdum's People

Contributors

evanplaice avatar jkvyff avatar reed-jones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

absurdum's Issues

objects.fromEntries

The inverse operation of Object.prototype.entries() This takes an array of [property, value] arrays and returns an object.

Checklist

  • implementation
  • tests
  • jsdoc

Details

const.log(objects.fromEntries([['age', 12034], ['name', 'Trair'],['state', 'Floating']]));
> { age: 12034, name: 'Trair', state: 'Floating' }

References

Add Travis-CI integration

In GitLab by @evanplaice on Jan 18, 2019, 23:07

CI testing makes eases the burden of collaboration.

  • add Travis-CI configuration
  • add status tag to README.md

arrays.find

The find() method returns the value of the first element in the provided array that satisfies the provided testing function.

Checklist

  • implementation
  • tests
  • jsdoc

Details

var array1 = [5, 12, 8, 130, 44];

var found = array1.find(function(element) {
  return element > 10;
});

console.log(found);
// expected output: 12

References

Revisit arrays.concat

Expected behaviour

The current implementation flattens the output

Actual behaviour

Is this correct?

References

`endsWith('abc', 'f')` returns `true`

endsWith('abc', 'f') returns true

Environment

  • Platform: Node
  • Version: 10.15.3
  • Operator: Ubuntu

Steps to reproduce

  • call function endsWith with arguments 'abc', and 'f'

Expected behaviour

should return false

Actual behaviour

returns true

Code

Seems like code could be replaced with:

const endsWith = (string, substr = '') =>
  string.substr(string.length - substr.length) === substr

arrays.tap

Tap iterates through the values and applies a supplied function to each value without mutating the data.

Tap is an exception to the 'only use reduce' rule because reduce would add inefficiency.

Checklist

  • implemented
  • documented
  • tested
  • check style

References

Transition development + testing to ES and provide ES + CJS for export

Currently, this lib is written as ES+ with the dist files and tests being provided as CJS.

Now that Node.JS has experimental support for ESM (EcmaScript Modules), see if it's viable to run/develop/test the code natively in ES6.

Milestones

  • convert tests to ES
  • remove chokodir watcher
  • verify the import entry-point works

arrays.flat

Notice: The existing implementation doesn't match spec. Feel free to use it or trash it.

The flat() method creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.

Checklist

  • implementation
  • tests
  • jsdoc

Details

Should this be implemented iteratively or recursively. Study the MDN documentation in more depth before implementing.

References

objects.include

Filters an object by key to only include properties whitelisted by the second arg

Milestones

  • implementation
  • tests
  • jsdoc

Details

To accomplish this, the object needs to be:

  • converted to an 2D array using Object.Entries()
  • filtered by key
  • converted back to an object

Due to the reliance on Object.entries() this function may not be compatible with some browsers.

References

arrays.some

some calls a function (the "test" function, defined by you) on each element of an array, and returns a boolean indicating whether or not the test function returned a truthy value for any element in the array. It "short circuits" as much computation as possible by terminating the array iteration as soon as an element is encountered for which the test function returns a truthy value

Checklist

  • implementation
  • tests
  • jsdoc

Details

function gotMilk(array) {
 return array.some((x) => x === 'milk');
}

gotMilk(['juice', 'water']); // false
gotMilk(['juice', 'milk', 'water']); // true

References

Add Issue Templates

In GitLab by @evanplaice on Jan 18, 2019, 23:07

Add templates for the following

  • ISSUE_TEMPLATE
  • PULL_REQUEST_TEMPLATE
  • Discussion()
  • Type()
  • Operator()

arrays.frequency

Takes an array of similar values and returns an object mapping each unique item to the number of items it occurs in the array.

Checklist

  • implementation
  • tests
  • jsdoc

Details

Reference implementation

const input = ['a', 'b', 'a', 'c', 'a', 'c', 'b'];
const frequencies = input.reduce((acc, curr) => {
  acc[curr] = !acc[curr] ? 1 : ++acc[curr];
  return acc;
}, {});
console.log(frequencies);
> {
>   a: 3,
>   b: 2,
>   c: 2
> }

References

strings.indexOf

The indexOf method returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex. Returns -1 if the value is not found.

Checklist

  • implementation
  • tests
  • jsdoc

Details

var paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?';

var searchTerm = 'dog';
var indexOfFirst = paragraph.indexOf(searchTerm);

console.log('The index of the first "' + searchTerm + '" from the beginning is ' + indexOfFirst);
// expected output: "The index of the first "dog" from the beginning is 40"

console.log('The index of the 2nd "' + searchTerm + '" is ' + paragraph.indexOf(searchTerm, (indexOfFirst + 1)));
// expected output: "The index of the 2nd "dog" is 52"

References

strings.reverse

Reverses the input string

Checklist

  • implemented
  • documented
  • tested
  • linted

Details

Takes an input string and reverses it's character order using reduce.

arrays.flatten

Flatten takes an array containing n-levels of nested arrays and flattens them into a one-dimensional array.

Checklist

  • implementation
  • tests
  • jsdoc

Details

Should this be implemented iteratively or recursively. Study the lodash documentation in more depth before implementing.

References

arrays.every

The every() method tests whether all elements in the array pass the test implemented by the provided function. It returns a Boolean value.

It always returns true if the array is empty

Checklist

  • implementation
  • tests
  • jsdoc

Details

function isBelowThreshold(currentValue) {
  return currentValue < 40;
}

var array1 = [1, 30, 39, 29, 10, 13];

console.log(array1.every(isBelowThreshold));
// expected output: true

References

Have any suggestions on automating the changelog?

CHANGELOG Update Strategy

Introduction

This project could benefit from a changelog. The commit history is pretty clean so the ideal solution would be to somehow add the capability to compile a list of changes using the commit titles and hand-edit out any extra crap.

Please comment below if you have any suggestions.

References

(Add Reference Links)

arrays.initial

Gets all but the last element of a the array

Checklist

  • implementation
  • tests
  • jsdoc

Details

References

Scaffold the documentation

In GitLab by @evanplaice on Jan 18, 2019, 23:07

Start mapping out the documentation structure

  • Add links to README.md
  • /docs/arrays.md
  • /docs/objects.md
  • /docs/strings.md
  • /docs/html.md
  • Make available via github.io

Update Issue/Merge Request template

In GitLab by @evanplaice on Jan 19, 2019, 00:12

Make the existing templates work with GitLab and add missing templates

Milestones

  • New Operator Template
  • Bug Template
  • Enhancement Template
  • Merge Request Template
  • New Type Template

arrays.chunk

Breaks an array up into chunks of a specified size

Checklist

  • implemented
  • documented
  • tested
  • linted

Details

References

arrays.findIndex

The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test.

Checklist

  • implementation
  • tests
  • jsdoc

Details

var array1 = [5, 12, 8, 130, 44];

function isLargeNumber(element) {
  return element > 13;
}

console.log(array1.findIndex(isLargeNumber));
// expected output: 3

References

arrays.indexOf

The indexOf method returns the first index at which a given element can be found in the array, or -1 if it is not present.

Checklist

  • implemented
  • documented
  • tested
  • linted

Details

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];

console.log(beasts.indexOf('bison'));
// expected output: 1

// start from index 2
console.log(beasts.indexOf('bison', 2));
// expected output: 4

console.log(beasts.indexOf('giraffe'));
// expected output: -1

References

Add CONTRIBUTING

In GitLab by @evanplaice on Jan 20, 2019, 03:45

Add CONTRUBUTING

Extract the contributor instructions into a separate file. Remove old links to GitHub templates.

Migrate CI to GitLab

In GitLab by @evanplaice on Jan 18, 2019, 23:57

Migrating from GitHub means Travis-CI is no longer an option.

Change the configuration to so this project runs CI through GitLab instead.

Milestones

  • Remove Travis-CI configuration
  • Add GitLab-CI configuration

arrays.head

Gets the first element of the array

Checklist

  • implementation
  • tests
  • jsdoc

Details

References

arrays.dropRight

Creates a slice of an array with a specified number of items dropped from the start.

Checklist

  • implemented
  • documented
  • tested
  • linted

Details

References

objects.exclude

Filters an object by key to only include properties not blacklisted by the second arg

Milestones

  • implementation
  • tests
  • jsdoc

Details

To accomplish this, the object needs to be:

  • converted to an 2D array using Object.Entries()
  • filtered by key
  • converted back to an object

Due to the reliance on Object.entries() this function may not be compatible with some browsers.

References

arrays.drop

Creates a slice of an array with a specified number of items dropped from the start.

Checklist

  • implemented
  • documented
  • tested
  • linted

Details

References

arrays.intersection

Creates an array of unique values that are included in all given arrays

Checklist

  • implementation
  • tests
  • jsdoc

Details

One possible approach:

Use something like frequency then filter the results so only the values that have the frequency of input.length are returned.

References

arrays.reverse

Takes a two-dimensional array, and a predicate. The two-dimensional array should contain two arrays of equal length. The values of each array are compared using the predicate.

Milestones

  • implemented
  • documented
  • tested
  • check style

Details

Add code snippets and/or a more in-depth description of the implementation details

References

arrays.zip

To quote the C#/Linq documentation for Zip:

The method merges each element of the first sequence with an element that has the same index in the second sequence. If the sequences do not have the same number of elements, the method merges sequences until it reaches the end of one of them. For example, if one sequence has three elements and the other one has four, the result sequence will have only three elements.

Milestones

  • implementation
  • tests
  • jsdoc

Details

References

arrays.compact

Filters all the falsy values (ie null, undefined, false, NaN, 0, "") out of an array.

Checklist

  • implemented
  • documented
  • tested
  • linted

Details

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.