This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export declare const checkIfNoSameElementExistInArray: <T extends unknown>(_array: T[]) => boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.checkIfNoSameElementExistInArray = void 0; | |
var checkIfNoSameElementExistInArray = function (_array) { | |
//return false if any overlapped value exist. | |
//return true if no same element exists. | |
var arrayLen = _array.length; | |
var set = new Set(_array); | |
var setLen = set.size; | |
return arrayLen === setLen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "@tofusoup429/pubfuncs", | |
"version": "1.0.5", | |
"description": "collection of trivial functions", | |
"main": "dist/index.js", | |
"author": "tofusoup429", | |
"license": "MIT", | |
"scripts": { | |
"build": "rm -rf dist && tsc" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es5", | |
"module": "commonjs", | |
"declaration": true, | |
"outDir": "./dist", | |
"strict": true, | |
"downlevelIteration": true | |
}, | |
"include": ["src"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const checkIfNoSameElementExistInArray = <T extends any>(_array:T[]):boolean => { | |
//return false if any overlapped value exist. | |
//return true if no same element exists. | |
let arrayLen:number = _array.length; | |
let set = new Set(_array); | |
let setLen = set.size; | |
return arrayLen === setLen | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export * from './arrayMinusArray'; | |
export * from './getSameKeyedValueFromObjectArray'; | |
export * from './checkIfNoSameElementExistsInArray'; | |
export * from './splitArray'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cars = ["Toyota", "Hyundai", "BMW"] | |
for(let i = 0; i<cars.length; i++){ | |
console.log(cars[i]) | |
} | |
/** | |
Toyota | |
Hyundai | |
BMW | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let originalArray = [1,2,3,4,5,6]; | |
let returnValue = originalArray.forEach((element, index, array)=>{ | |
if(element%2) console.log(index, element, array); | |
}) | |
console.log('returnValue', returnValue) | |
/** | |
0 1 [ 1, 2, 3, 4, 5, 6 ] | |
2 3 [ 1, 2, 3, 4, 5, 6 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let originalArray = [1,2,3,4,5,6]; | |
originalArray.forEach((element, index, array)=>{ | |
if(!element%2) console.log(index, element, array); | |
}) | |
/** | |
0 1 [ 1, 2, 3, 4, 5, 6 ] | |
2 3 [ 1, 2, 3, 4, 5, 6 ] | |
4 5 [ 1, 2, 3, 4, 5, 6 ] | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let originalArray = [1,2,3,4,5,6]; | |
originalArray.forEach((element, index)=>{ | |
if(!element%2) console.log(index, element); | |
}) | |
/** | |
0 1 | |
2 3 | |
4 5 | |
**/ |