From a6f11c36be806fa40a6a28ae3c489362d1034c70 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 28 Dec 2017 12:17:49 +0200 Subject: [PATCH] Updaet builder --- README.md | 140 ++++++++++++++++++++++++++++++++++++++++ scripts/build-script.js | 2 +- 2 files changed, 141 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 899b65e36..44cbafc67 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ Promise.resolve([1, 2, 3]) [⬆ Back to top](#table-of-contents) + --- ### collectInto @@ -233,6 +234,7 @@ Pall(p1, p2, p3).then(console.log); [⬆ Back to top](#table-of-contents) + --- ### flip @@ -262,6 +264,7 @@ Object.assign(b, a); // == b [⬆ Back to top](#table-of-contents) + --- ### pipeFunctions @@ -289,6 +292,7 @@ multiplyAndAdd5(5, 2); // 15 [⬆ Back to top](#table-of-contents) + --- ### promisify @@ -319,6 +323,7 @@ delay(2000).then(() => console.log('Hi!')); // // Promise resolves after 2s [⬆ Back to top](#table-of-contents) + --- ### spreadOver @@ -344,6 +349,7 @@ arrayMax([1, 2, 4]); // 4 [⬆ Back to top](#table-of-contents) + --- ## Array @@ -372,6 +378,7 @@ arrayGcd([4, 8, 12]); // 4 [⬆ Back to top](#table-of-contents) + --- ### arrayLcm @@ -400,6 +407,7 @@ arrayLcm([4, 8, 12]); // 24 [⬆ Back to top](#table-of-contents) + --- ### arrayMax @@ -423,6 +431,7 @@ arrayMax([10, 1, 5]); // 10 [⬆ Back to top](#table-of-contents) + --- ### arrayMin @@ -446,6 +455,7 @@ arrayMin([10, 1, 5]); // 1 [⬆ Back to top](#table-of-contents) + --- ### chunk @@ -474,6 +484,7 @@ chunk([1, 2, 3, 4, 5], 2); // [[1,2],[3,4],[5]] [⬆ Back to top](#table-of-contents) + --- ### compact @@ -497,6 +508,7 @@ compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34]); // [ 1, 2, 3, 'a' [⬆ Back to top](#table-of-contents) + --- ### countOccurrences @@ -520,6 +532,7 @@ countOccurrences([1, 1, 2, 1, 2, 3], 1); // 3 [⬆ Back to top](#table-of-contents) + --- ### deepFlatten @@ -545,6 +558,7 @@ deepFlatten([1, [2], [[3], 4], 5]); // [1,2,3,4,5] [⬆ Back to top](#table-of-contents) + --- ### difference @@ -571,6 +585,7 @@ difference([1, 2, 3], [1, 2, 4]); // [3] [⬆ Back to top](#table-of-contents) + --- ### differenceWith @@ -594,6 +609,7 @@ differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a, b) => Math.round(a) == Math.round [⬆ Back to top](#table-of-contents) + --- ### distinctValuesOfArray @@ -617,6 +633,7 @@ distinctValuesOfArray([1, 2, 2, 3, 4, 4, 5]); // [1,2,3,4,5] [⬆ Back to top](#table-of-contents) + --- ### dropElements @@ -644,6 +661,7 @@ dropElements([1, 2, 3, 4], n => n >= 3); // [3,4] [⬆ Back to top](#table-of-contents) + --- ### dropRight @@ -669,6 +687,7 @@ dropRight([1, 2, 3], 42); // [] [⬆ Back to top](#table-of-contents) + --- ### everyNth @@ -692,6 +711,7 @@ everyNth([1, 2, 3, 4, 5, 6], 2); // [ 2, 4, 6 ] [⬆ Back to top](#table-of-contents) + --- ### filterNonUnique @@ -715,6 +735,7 @@ filterNonUnique([1, 2, 2, 3, 4, 4, 5]); // [1,3,5] [⬆ Back to top](#table-of-contents) + --- ### flatten @@ -738,6 +759,7 @@ flatten([1, [2], 3, 4]); // [1,2,3,4] [⬆ Back to top](#table-of-contents) + --- ### flattenDepth @@ -767,6 +789,7 @@ flattenDepth([1, [2], 3, 4]); // [1,2,3,4] [⬆ Back to top](#table-of-contents) + --- ### groupBy @@ -796,6 +819,7 @@ groupBy(['one', 'two', 'three'], 'length'); // {3: ['one', 'two'], 5: ['three']} [⬆ Back to top](#table-of-contents) + --- ### head @@ -819,6 +843,7 @@ head([1, 2, 3]); // 1 [⬆ Back to top](#table-of-contents) + --- ### initial @@ -842,6 +867,7 @@ initial([1, 2, 3]); // [1,2] [⬆ Back to top](#table-of-contents) + --- ### initialize2DArray @@ -868,6 +894,7 @@ initialize2DArray(2, 2, 0); // [[0,0], [0,0]] [⬆ Back to top](#table-of-contents) + --- ### initializeArrayWithRange @@ -894,6 +921,7 @@ initializeArrayWithRange(7, 3); // [3,4,5,6,7] [⬆ Back to top](#table-of-contents) + --- ### initializeArrayWithValues @@ -918,6 +946,7 @@ initializeArrayWithValues(5, 2); // [2,2,2,2,2] [⬆ Back to top](#table-of-contents) + --- ### intersection @@ -944,6 +973,7 @@ intersection([1, 2, 3], [4, 3, 2]); // [2,3] [⬆ Back to top](#table-of-contents) + --- ### last @@ -967,6 +997,7 @@ last([1, 2, 3]); // 3 [⬆ Back to top](#table-of-contents) + --- ### mapObject @@ -994,6 +1025,7 @@ squareIt([1, 2, 3]); // { 1: 1, 2: 4, 3: 9 } [⬆ Back to top](#table-of-contents) + --- ### nthElement @@ -1020,6 +1052,7 @@ nthElement(['a', 'b', 'b'], -3); // 'a' [⬆ Back to top](#table-of-contents) + --- ### pick @@ -1044,6 +1077,7 @@ pick({ a: 1, b: '2', c: 3 }, ['a', 'c']); // { 'a': 1, 'c': 3 } [⬆ Back to top](#table-of-contents) + --- ### pull @@ -1081,6 +1115,7 @@ console.log(myArray2); // [ 'b', 'b' ] [⬆ Back to top](#table-of-contents) + --- ### pullAtIndex @@ -1118,6 +1153,7 @@ console.log(pulled); // [ 'b', 'd' ] [⬆ Back to top](#table-of-contents) + --- ### pullAtValue @@ -1153,6 +1189,7 @@ console.log(pulled); // [ 'b', 'd' ] [⬆ Back to top](#table-of-contents) + --- ### remove @@ -1183,6 +1220,7 @@ remove([1, 2, 3, 4], n => n % 2 == 0); // [2, 4] [⬆ Back to top](#table-of-contents) + --- ### sample @@ -1207,6 +1245,7 @@ sample([3, 7, 9, 11]); // 9 [⬆ Back to top](#table-of-contents) + --- ### shuffle @@ -1239,6 +1278,7 @@ console.log(foo); // [1,2,3] [⬆ Back to top](#table-of-contents) + --- ### similarity @@ -1262,6 +1302,7 @@ similarity([1, 2, 3], [1, 2, 4]); // [1,2] [⬆ Back to top](#table-of-contents) + --- ### symmetricDifference @@ -1289,6 +1330,7 @@ symmetricDifference([1, 2, 3], [1, 2, 4]); // [3,4] [⬆ Back to top](#table-of-contents) + --- ### tail @@ -1313,6 +1355,7 @@ tail([1]); // [1] [⬆ Back to top](#table-of-contents) + --- ### take @@ -1337,6 +1380,7 @@ take([1, 2, 3], 0); // [] [⬆ Back to top](#table-of-contents) + --- ### takeRight @@ -1361,6 +1405,7 @@ takeRight([1, 2, 3]); // [3] [⬆ Back to top](#table-of-contents) + --- ### union @@ -1384,6 +1429,7 @@ union([1, 2, 3], [4, 3, 2]); // [1,2,3,4] [⬆ Back to top](#table-of-contents) + --- ### without @@ -1409,6 +1455,7 @@ without([2, 1, 2, 3], 1, 2); // [3] [⬆ Back to top](#table-of-contents) + --- ### zip @@ -1440,6 +1487,7 @@ zip(['a'], [1, 2], [true, false]); // [['a', 1, true], [undefined, 2, false]] [⬆ Back to top](#table-of-contents) + --- ### zipObject @@ -1465,6 +1513,7 @@ zipObject(['a', 'b'], [1, 2, 3]); // {a: 1, b: 2} [⬆ Back to top](#table-of-contents) + --- ## Browser @@ -1490,6 +1539,7 @@ arrayToHtmlList(['item 1', 'item 2'], 'myListID'); [⬆ Back to top](#table-of-contents) + --- ### bottomVisible @@ -1515,6 +1565,7 @@ bottomVisible(); // true [⬆ Back to top](#table-of-contents) + --- ### currentURL @@ -1538,6 +1589,7 @@ currentURL(); // 'https://google.com' [⬆ Back to top](#table-of-contents) + --- ### detectDeviceType @@ -1565,6 +1617,7 @@ detectDeviceType(); // "Desktop" [⬆ Back to top](#table-of-contents) + --- ### elementIsVisibleInViewport @@ -1600,6 +1653,7 @@ elementIsVisibleInViewport(el, true); // true // (partially visible) [⬆ Back to top](#table-of-contents) + --- ### getScrollPosition @@ -1627,6 +1681,7 @@ getScrollPosition(); // {x: 0, y: 200} [⬆ Back to top](#table-of-contents) + --- ### getURLParameters @@ -1654,6 +1709,7 @@ getURLParameters('http://url.com/page?name=Adam&surname=Smith'); // {name: 'Adam [⬆ Back to top](#table-of-contents) + --- ### httpsRedirect @@ -1675,6 +1731,7 @@ const httpsRedirect = () => { [⬆ Back to top](#table-of-contents) + --- ### redirect @@ -1700,6 +1757,7 @@ redirect('https://google.com'); [⬆ Back to top](#table-of-contents) + --- ### scrollToTop @@ -1730,6 +1788,7 @@ scrollToTop(); [⬆ Back to top](#table-of-contents) + --- ## Date @@ -1755,6 +1814,7 @@ getDaysDiffBetweenDates(new Date('2017-12-13'), new Date('2017-12-22')); // 9 [⬆ Back to top](#table-of-contents) + --- ### JSONToDate @@ -1781,6 +1841,7 @@ JSONToDate(/Date(1489525200000)/); // "14/3/2017" [⬆ Back to top](#table-of-contents) + --- ### toEnglishDate @@ -1812,6 +1873,7 @@ toEnglishDate('09/21/2010'); // '21/09/2010' [⬆ Back to top](#table-of-contents) + --- ### tomorrow @@ -1834,6 +1896,7 @@ tomorrow(); // 2017-12-27 (if current date is 2017-12-26) [⬆ Back to top](#table-of-contents) + --- ## Function @@ -1874,6 +1937,7 @@ chainAsync([ [⬆ Back to top](#table-of-contents) + --- ### compose @@ -1901,6 +1965,7 @@ multiplyAndAdd5(5, 2); // 15 [⬆ Back to top](#table-of-contents) + --- ### curry @@ -1929,6 +1994,7 @@ curry(Math.min, 3)(10)(50)(2); // 2 [⬆ Back to top](#table-of-contents) + --- ### functionName @@ -1952,6 +2018,7 @@ functionName(Math.max); // max (logged in debug channel of console) [⬆ Back to top](#table-of-contents) + --- ### runPromisesInSeries @@ -1976,6 +2043,7 @@ runPromisesInSeries([() => delay(1000), () => delay(2000)]); // //executes each [⬆ Back to top](#table-of-contents) + --- ### sleep @@ -2003,6 +2071,7 @@ async function sleepyWork() { [⬆ Back to top](#table-of-contents) + --- ## Logic @@ -2028,6 +2097,7 @@ negate(isOdd)(1); // false [⬆ Back to top](#table-of-contents) + --- ## Math @@ -2052,6 +2122,7 @@ arrayAverage([1, 2, 3]); // 2 [⬆ Back to top](#table-of-contents) + --- ### arraySum @@ -2075,6 +2146,7 @@ arraySum([1, 2, 3, 4]); // 10 [⬆ Back to top](#table-of-contents) + --- ### clampNumber @@ -2101,6 +2173,7 @@ clampNumber(3, 2, 4); // 3 [⬆ Back to top](#table-of-contents) + --- ### collatz @@ -2125,6 +2198,7 @@ collatz(5); // 16 [⬆ Back to top](#table-of-contents) + --- ### digitize @@ -2149,6 +2223,7 @@ digitize(123); // [1, 2, 3] [⬆ Back to top](#table-of-contents) + --- ### distance @@ -2172,6 +2247,7 @@ distance(1, 1, 2, 3); // 2.23606797749979 [⬆ Back to top](#table-of-contents) + --- ### factorial @@ -2203,6 +2279,7 @@ factorial(6); // 720 [⬆ Back to top](#table-of-contents) + --- ### fibonacci @@ -2231,6 +2308,7 @@ fibonacci(6); // 720 [⬆ Back to top](#table-of-contents) + --- ### fibonacciCountUntilNum @@ -2255,6 +2333,7 @@ fibonacciCountUntilNum(10); // 7 [⬆ Back to top](#table-of-contents) + --- ### fibonacciUntilNum @@ -2286,6 +2365,7 @@ fibonacciCountUntilNum(10); // 7 [⬆ Back to top](#table-of-contents) + --- ### gcd @@ -2311,6 +2391,7 @@ gcd(8, 36); // 4 [⬆ Back to top](#table-of-contents) + --- ### hammingDistance @@ -2335,6 +2416,7 @@ hammingDistance(2, 3); // 1 [⬆ Back to top](#table-of-contents) + --- ### inRange @@ -2365,6 +2447,7 @@ inrange(3, 2); // false [⬆ Back to top](#table-of-contents) + --- ### isArmstrongNumber @@ -2393,6 +2476,7 @@ isArmstrongNumber(56); // false [⬆ Back to top](#table-of-contents) + --- ### isDivisible @@ -2416,6 +2500,7 @@ isDivisible(6, 3); // true [⬆ Back to top](#table-of-contents) + --- ### isEven @@ -2440,6 +2525,7 @@ isEven(3); // false [⬆ Back to top](#table-of-contents) + --- ### isPrime @@ -2469,6 +2555,7 @@ isPrime(12); // false [⬆ Back to top](#table-of-contents) + --- ### lcm @@ -2496,6 +2583,7 @@ lcm(12, 7); // 84 [⬆ Back to top](#table-of-contents) + --- ### median @@ -2525,6 +2613,7 @@ median([0, 10, -2, 7]); // 3.5 [⬆ Back to top](#table-of-contents) + --- ### palindrome @@ -2558,6 +2647,7 @@ palindrome('taco cat'); // true [⬆ Back to top](#table-of-contents) + --- ### percentile @@ -2582,6 +2672,7 @@ percentile([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 6); // 55 [⬆ Back to top](#table-of-contents) + --- ### powerset @@ -2605,6 +2696,7 @@ powerset([1, 2]); // [[], [1], [2], [2,1]] [⬆ Back to top](#table-of-contents) + --- ### primes @@ -2634,6 +2726,7 @@ primes(10); // [2,3,5,7] [⬆ Back to top](#table-of-contents) + --- ### randomIntegerInRange @@ -2657,6 +2750,7 @@ randomIntegerInRange(0, 5); // 2 [⬆ Back to top](#table-of-contents) + --- ### randomNumberInRange @@ -2680,6 +2774,7 @@ randomNumberInRange(2, 10); // 6.0211363285087005 [⬆ Back to top](#table-of-contents) + --- ### round @@ -2704,6 +2799,7 @@ round(1.005, 2); // 1.01 [⬆ Back to top](#table-of-contents) + --- ### standardDeviation @@ -2738,6 +2834,7 @@ standardDeviation([10, 2, 38, 23, 38, 23, 21], true); // 12.29899614287479 (popu [⬆ Back to top](#table-of-contents) + --- ## Media @@ -2769,6 +2866,7 @@ speechSynthesis('Hello, World'); // // plays the message [⬆ Back to top](#table-of-contents) + --- ## Node @@ -2795,6 +2893,7 @@ JSONToFile({ test: 'is passed' }, 'testJsonFile'); // writes the object to 'test [⬆ Back to top](#table-of-contents) + --- ### readFileLines @@ -2834,6 +2933,7 @@ console.log(arr); // ['line1', 'line2', 'line3'] [⬆ Back to top](#table-of-contents) + --- ## Object @@ -2869,6 +2969,7 @@ cleanObj(testObj, ['a'], 'children'); // { a: 1, children : { a: 1}} [⬆ Back to top](#table-of-contents) + --- ### objectFromPairs @@ -2892,6 +2993,7 @@ objectFromPairs([['a', 1], ['b', 2]]); // {a: 1, b: 2} [⬆ Back to top](#table-of-contents) + --- ### objectToPairs @@ -2915,6 +3017,7 @@ objectToPairs({ a: 1, b: 2 }); // [['a',1],['b',2]]) [⬆ Back to top](#table-of-contents) + --- ### orderBy @@ -2955,6 +3058,7 @@ orderBy(users, ['name', 'age']); // [{name: 'barney', age: 34}, {name: 'barney', [⬆ Back to top](#table-of-contents) + --- ### select @@ -2980,6 +3084,7 @@ select(obj, 'selector.to.val'); // 'val to select' [⬆ Back to top](#table-of-contents) + --- ### shallowClone @@ -3005,6 +3110,7 @@ a === b; // false [⬆ Back to top](#table-of-contents) + --- ### truthCheckCollection @@ -3028,6 +3134,7 @@ truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex [⬆ Back to top](#table-of-contents) + --- ## String @@ -3064,6 +3171,7 @@ anagrams('abc'); // ['abc','acb','bac','bca','cab','cba'] [⬆ Back to top](#table-of-contents) + --- ### Capitalize @@ -3090,6 +3198,7 @@ capitalize('fooBar', true); // 'Foobar' [⬆ Back to top](#table-of-contents) + --- ### capitalizeEveryWord @@ -3113,6 +3222,7 @@ capitalizeEveryWord('hello world!'); // 'Hello World!' [⬆ Back to top](#table-of-contents) + --- ### countVowels @@ -3137,6 +3247,7 @@ countVowels('gym'); // 0 [⬆ Back to top](#table-of-contents) + --- ### escapeRegExp @@ -3160,6 +3271,7 @@ escapeRegExp('(test)'); // \\(test\\) [⬆ Back to top](#table-of-contents) + --- ### fromCamelCase @@ -3190,6 +3302,7 @@ fromCamelCase('someJavascriptProperty', '_'); // 'some_javascript_property' [⬆ Back to top](#table-of-contents) + --- ### repeatString @@ -3216,6 +3329,7 @@ repeatString('abc'); // 'abcabc' [⬆ Back to top](#table-of-contents) + --- ### reverseString @@ -3244,6 +3358,7 @@ reverseString('foobar'); // 'raboof' [⬆ Back to top](#table-of-contents) + --- ### sortCharactersInString @@ -3271,6 +3386,7 @@ sortCharactersInString('cabbage'); // 'aabbceg' [⬆ Back to top](#table-of-contents) + --- ### toCamelCase @@ -3306,6 +3422,7 @@ toCamelCase('some-mixed_string with spaces_underscores-and-hyphens'); // 'someMi [⬆ Back to top](#table-of-contents) + --- ### toKebabCase @@ -3339,6 +3456,7 @@ toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSo [⬆ Back to top](#table-of-contents) + --- ### toSnakeCase @@ -3374,6 +3492,7 @@ toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSo [⬆ Back to top](#table-of-contents) + --- ### truncateString @@ -3399,6 +3518,7 @@ truncateString('boomerang', 7); // 'boom...' [⬆ Back to top](#table-of-contents) + --- ### words @@ -3424,6 +3544,7 @@ words('python, javaScript & coffee'); // ["python", "javaScript", "coffee"] [⬆ Back to top](#table-of-contents) + --- ## Utility @@ -3448,6 +3569,7 @@ coalesce(null, undefined, '', NaN, 'Waldo'); // "" [⬆ Back to top](#table-of-contents) + --- ### coalesceFactory @@ -3472,6 +3594,7 @@ customCoalesce(undefined, null, NaN, '', 'Waldo'); // "Waldo" [⬆ Back to top](#table-of-contents) + --- ### extendHex @@ -3502,6 +3625,7 @@ extendHex('05a'); // '#0055aa' [⬆ Back to top](#table-of-contents) + --- ### getType @@ -3526,6 +3650,7 @@ getType(new Set([1, 2, 3])); // "set" [⬆ Back to top](#table-of-contents) + --- ### hexToRGB @@ -3569,6 +3694,7 @@ hexToRGB('#fff'); // 'rgb(255, 255, 255)' [⬆ Back to top](#table-of-contents) + --- ### isArray @@ -3593,6 +3719,7 @@ isArray([1]); // true [⬆ Back to top](#table-of-contents) + --- ### isBoolean @@ -3617,6 +3744,7 @@ isBoolean(false); // true [⬆ Back to top](#table-of-contents) + --- ### isFunction @@ -3641,6 +3769,7 @@ isFunction(x => x); // true [⬆ Back to top](#table-of-contents) + --- ### isNumber @@ -3664,6 +3793,7 @@ isNumber(1); // true [⬆ Back to top](#table-of-contents) + --- ### isString @@ -3688,6 +3818,7 @@ isString('10'); // true [⬆ Back to top](#table-of-contents) + --- ### isSymbol @@ -3712,6 +3843,7 @@ isSymbol(Symbol('x')); // true [⬆ Back to top](#table-of-contents) + --- ### randomHexColorCode @@ -3740,6 +3872,7 @@ randomHexColorCode(); // "#4144c6" [⬆ Back to top](#table-of-contents) + --- ### RGBToHex @@ -3763,6 +3896,7 @@ RGBToHex(255, 165, 1); // 'ffa501' [⬆ Back to top](#table-of-contents) + --- ### sbdm @@ -3794,6 +3928,7 @@ console.log(sdbm('age')); // 808122783 [⬆ Back to top](#table-of-contents) + --- ### timeTaken @@ -3823,6 +3958,7 @@ timeTaken(() => Math.pow(2, 10)); // 1024 [⬆ Back to top](#table-of-contents) + --- ### toDecimalMark @@ -3844,6 +3980,7 @@ toDecimalMark(12305030388.9087); // "12,305,030,388.9087" [⬆ Back to top](#table-of-contents) + --- ### toOrdinalSuffix @@ -3878,6 +4015,7 @@ toOrdinalSuffix('123'); // "123rd" [⬆ Back to top](#table-of-contents) + --- ### UUIDGenerator @@ -3904,6 +4042,7 @@ UUIDGenerator(); // '7982fcfe-5721-4632-bede-6000885be57d' [⬆ Back to top](#table-of-contents) + --- ### validateNumber @@ -3929,6 +4068,7 @@ validateNumber('10'); // true [⬆ Back to top](#table-of-contents) + --- ## Credits diff --git a/scripts/build-script.js b/scripts/build-script.js index 34e69220b..8ea58d053 100644 --- a/scripts/build-script.js +++ b/scripts/build-script.js @@ -79,7 +79,7 @@ try { for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag)){ let data = snippets[taggedSnippet[0]+'.md']; data = data.slice(0,data.lastIndexOf('```js')) + '
\nExamples\n\n' + data.slice(data.lastIndexOf('```js'),data.lastIndexOf('```')) + data.slice(data.lastIndexOf('```')) + '\n
\n'; - output += `\n${data+'\n\n[⬆ Back to top](#table-of-contents)\n---\n'}`; + output += `\n${data+'\n\n[⬆ Back to top](#table-of-contents)\n\n---\n'}`; } } }