tedirghazali / alga-js

Alga.js is javascript helper for helping build a component of any front-end web frameworks
https://algajs.tedir.dev
Other
18 stars 41 forks source link

Array.uniq throws error on vite #5

Open Utitofon-Udoekong opened 2 years ago

Utitofon-Udoekong commented 2 years ago

I am using nuxt 3 and I want to implement a filter method by comparing dates in my array of objects to a future date then returning an array satisfying the condition like below Screenshot_6

I thought of using array.uniq but vite throws an error that it is not found Screenshot_7

Can this be an internal issue?

tedirghazali commented 2 years ago

I think the name of function is array.unique with "ue", but if you want manually you can use js Set like for instance Array.from(new Set([].map()))

Pada tanggal Sen, 11 Apr 2022 06.02, utitofon @.***> menulis:

I am using nuxt 3 and I want to implement a filter method by comparing dates in my array of objects to a future date then returning an array satisfying the condition like below [image: Screenshot_6] https://user-images.githubusercontent.com/69417647/162643602-badab373-7471-4d2d-b229-1637318a4861.png

I thought of using array.uniq but vite throws an error that it is not found [image: Screenshot_7] https://user-images.githubusercontent.com/69417647/162643623-7d82566a-7c92-4630-98fe-472d4ce8423c.png

Can this be an internal issue?

— Reply to this email directly, view it on GitHub https://github.com/tedirghazali/alga-js/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMYO4NR4FOEA232WWO4IT3VENMXRANCNFSM5TBPWT2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tedirghazali commented 2 years ago

if you want to use new version, you need to import individual library like

import { uniq, take } from 'alga-js/array'

usage:

uniq(arrOfObjs/arrOfArrs/arrOfPrimitives, objPropOptional/indexNumberInCaseArrOfArrs) to filter only unique values

take(arrOfObjs/arrOfArrsOnly, Prop/Index/CallBackFunc) to take the values from property of object or index of array

Pada tanggal Sen, 11 Apr 2022 06.02, utitofon @.***> menulis:

I am using nuxt 3 and I want to implement a filter method by comparing dates in my array of objects to a future date then returning an array satisfying the condition like below [image: Screenshot_6] https://user-images.githubusercontent.com/69417647/162643602-badab373-7471-4d2d-b229-1637318a4861.png

I thought of using array.uniq but vite throws an error that it is not found [image: Screenshot_7] https://user-images.githubusercontent.com/69417647/162643623-7d82566a-7c92-4630-98fe-472d4ce8423c.png

Can this be an internal issue?

— Reply to this email directly, view it on GitHub https://github.com/tedirghazali/alga-js/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMYO4NR4FOEA232WWO4IT3VENMXRANCNFSM5TBPWT2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tedirghazali commented 2 years ago

for more information about uniq and take, please take a look at test folder, inside array folder, there have 2 files which is uniqArray.test.ts and takeArray.test.ts

Pada tanggal Sen, 11 Apr 2022 06.02, utitofon @.***> menulis:

I am using nuxt 3 and I want to implement a filter method by comparing dates in my array of objects to a future date then returning an array satisfying the condition like below [image: Screenshot_6] https://user-images.githubusercontent.com/69417647/162643602-badab373-7471-4d2d-b229-1637318a4861.png

I thought of using array.uniq but vite throws an error that it is not found [image: Screenshot_7] https://user-images.githubusercontent.com/69417647/162643623-7d82566a-7c92-4630-98fe-472d4ce8423c.png

Can this be an internal issue?

— Reply to this email directly, view it on GitHub https://github.com/tedirghazali/alga-js/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMYO4NR4FOEA232WWO4IT3VENMXRANCNFSM5TBPWT2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Utitofon-Udoekong commented 2 years ago

Thank you. I will try this out and get back to you

tedirghazali commented 2 years ago

Great, thanks!

Pada tanggal Sel, 12 Apr 2022 04.21, utitofon @.***> menulis:

Thank you. I will try this out and get back to you

— Reply to this email directly, view it on GitHub https://github.com/tedirghazali/alga-js/issues/5#issuecomment-1095578303, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMYO4LLHKLIF2YTTM6USRLVESJWBANCNFSM5TBPWT2Q . You are receiving this because you commented.Message ID: @.***>