« first day (4365 days earlier)      last day (580 days later) » 

6:27 AM
Today on Stack Overflow - how to professionally use arrays: Is there a better way of writing variableName[0]? More specifically, a professional way to get the first item of an array.
You can use spread operator.

const [data...] = variableName;
console.log(data);
So, it's not an operator. It's not even spreading. That so far leaves the correct words being "You can use". But you cannot, since the syntax is wrong. Basically, the only word that is not wrong is "You".
 
 
2 hours later…
8:00 AM
@SuperUberDuper tutorial is bad
 
 
1 hour later…
9:01 AM
rip
 
 
2 hours later…
10:34 AM
hi developpers
 
@hadjer_22 Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
could someone help me handling curved linestring problems of openlayers ? pleaaaase!
 
please do check the message from Jamesbot: just post your question
I am somewhat intrigued though. Most of the questions are small here, not that kind of
but ... i've a meeting. Just post and we will see
cfr;
> If you have a question, just post it, and if anyone's free and interested they'll help.
 
10:51 AM
sorry, i'm new here , i have created a curvedLinestring with( openlayers & turf) then i need to split it to segments where the segment represent the line from poigne to another, and it has it's own stroke color and some shapes. i managed to do that but the issue while modifying i lost control , always the original line is mooved
i have posted the question here stackoverflow.com/questions/73872122/…
 
11:04 AM
Hello
Please help
objValue && key.split('.').every((x) => objValue.toString().includes(x))
this works for values with .
but when I try to search for 0.00 does not work
how to combine all possible solutions ?
So , how to filter date values with and also the other values with dot ?
 
12:03 PM
that last question is confusing. With and then with. Don't you mean without?
Use regex if you want, \.? makes it optional
 
 
2 hours later…
2:26 PM
I have the eslint prettier plugin, but I still get this error:

error Expected indentation of 4 spaces but found 2 indent

even if I set: "tabWidth": 2 in .prettierrc.json
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:solid/recommended",
    "prettier",
  ],
eslint rc ^
 
that sounds fun
 
Karel how to do that ?
When I add ('\.?') , it's formatted to ('.?')
which is not the same ?
 
2:43 PM
escape it ?
you know what a \ does in a string?
 
3:00 PM
like this
key.split(/\.?/).every((x)
?
 
@SuperUberDuper You probably need to set the indentation to only spaces or only tabs
Actually no, wait. Just checked tabWidth is a Prettier option for what the indentation level should be...
So, it must be telling you that the indentation is wrong.
If in doubt, try running an autofix on the file and see what it gives you.
 
hmm

✖ 906 problems (883 errors, 23 warnings)
  880 errors and 8 warnings potentially fixable with the `--fix` option.
backing up
 
All this in one file?
 
all src
 
Ah, OK
 
3:40 PM
posted on September 28, 2022 by Ben Mason

Hi everyone! We've just released Chrome Stable 106 (106.0.5249.70) for iOS; it'll become available on App Store in the next few hours. This release includes stability and performance improvements. You can see a full list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Harry Souders Google Chrome

 
@JBis Because it was possible. I guess. It says "See the WordPress.org blog post explaining why is this useful and how does it work for more details." and I skimmed that link but what I gathered was that whoever wrote it was excited to do it.
Also there is some talk that it's easier to work with WordPress if it's in the browser but...dunno how much it hold up.
 
I'm stuck at a problem, Where I'm not able to find the position of scrollbar with respect to the parent node which is not window
Need to figure out position of a scrollbar of small column
Any way to add pictures in the chat
 
 
1 hour later…
5:26 PM
131
Q: javascript filter array multiple conditions

user3673623I want to simplify an array of objects. Let's assume that I have following array: var users = [{ name: 'John', email: 'johnson@mail.com', age: 25, address: 'USA' }, { name: 'Tom', email: 'tom@mail.com', age: 35, address: 'England' }, ...

I am trying to implement any solution from this topic
but I am struggling
I have one specific situation where I want to allow user to filter values with dot
@KarelG
Regex is not what I want
I tried with /[.]?/
 
regex is not what i want. shows some regex i tried
 
/[.]?/
With .split('.')
works perfectly for date
 
simplest method would be to simply do a filter on rows, with a find on cells for a string to string match, where the string you're comparing against is the string being displayed in the table
 
but how to filter price and trade for example
 
so if you're displaying dates as aa.bb.cc, you convert it to that format before you compare
exactly the same way
 
5:38 PM
I am formatting the date
 
compare against the generated string, not the raw data
 
So now the date is in format 22.06.2022
format with moment library
 const filteredRowData = rows.filter((row: TableRowData) => {
    const foundRow = Object.values(row).find((objValue) => {
      return (
        objValue &&
        key.split('.').every((x) => objValue.toString().includes(x))
      )
    })
    return foundRow !== undefined
  })
 
right, but like
that's... kinda unnecessary
return objValue && key.includes(objValue) would be far more intuitive for the enduser
if they want to search for 22.8, the above would match it
if they wanted to search for 22.1, it'd match both 22.1, 22.11, 22.12, and 22.21, where as the last one doesn't directly match what they put in.
using that same rule for all of the keys would work
 
Argument of type 'string | number | true | ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.
@KevinB are you serious ?
your solution returns empty table
1. I don't have any value
 
i don't have your code in front of me in a way such that i can run it
so any code i provide is with the disclaimer that you need to modify it to fit your needs.
it not working isn't my problem
;)
What i'm saying is you have multiple types of values, but all of them are displayed as strings. If you take the user's search input, which is a string, and search each of the generated strings as they are displayed in the table, you will get a result that matches what the user expects.
 
5:50 PM
row is an object
balance
:
35999.97
booking_date
:
"2022.08.26"
code_name
:
"mutationType.purchase"
credit
:
0
debit
:
31999.99
file_id
:
41996
net_amount
:
-31999.99
price
:
146.12
quantity
:
218.998
type
:
"Purchase Tellco Classic - Strategy 45"
value_date
:
"2022.08.26"
 
i don't care
morph the value you're working with to match what is in the table
 
I can't find 31999.99
but can 26.08
I don't understand why
 
if you're turning every value in the row object to a string and then splitting on ".", you're going to get weird results
 
maybe because other values are numbers ?
 
particularly when the user uses a "." in their search
 
5:55 PM
Maybe because amount values are number ?
 
31999.99
you converted that to a string, so now it's "31999.99"
you then split it on "."
now your search term doesn't match either side
 
it's 3199999
??
or not
 
when you split it on ".", it becomes ["31999","99"]
 
Ohh, I don't want that
But why the search result with date works good then ?
 
because the search process you're using is built for working with dates
for some reason you wanted to handle dates specifically, so the solutions you got was for that
ignoring all the other types of values
 
5:58 PM
No, it's not just for dates
 
obviously
-1
Q: How to filter array of strings from object , with dot between search terms?

Mile Mijatovićplease consider this array of two objects where I have value_date with date values [yyyy, m, dd]. I want to create a functionality to allow user to enter date for example (26.07.2022.) and result should be an object with type Strategy Low risk 1. [ { "value_date": [ 2022, ...

the code you're using here is specifically trying to handle dates as special
when all you needed to do is handle them like any other value
your table displays dates as 26.07.2022, therefore when the user types 26.07, it should find any row that has a date value that, when converted into that same format, contains the string 26.07
 
Hmm
return objValue && objValue?.toString().includes(key)
This solution works perfectly for any other column expect date
 
without objValue &&
but what format is your date in when .toString() is called on it?
["26","07","2022"]?
as in your question?
because I think you can understand why .toString on that doesn't result in "26.07.2022"
 
I am totally confused
 
if your dates are actually as they are in the image you provided above, it would have worked
 
6:06 PM
No, it's not in array Kevin
date is not in an array
it's converted to string
it's not [2022, 8, 26] as before
 
!!> [{foo: "2022.08.26", bar: 31999.99}].filter(obj => Object.values(obj).some(val => val.toString().includes('31999.99')))
 
@KevinB [ { foo: '2022.08.26', bar: 31999.99 } ] Logged: [ ] Took: 0ms
@KevinB 'TypeError: val.includes is not a function' Logged: [ ] Took: 0ms
 
wut james
oh, right
 
@KevinB [ { foo: '2022.08.26', bar: 31999.99 } ] Logged: [ ] Took: 0ms
 
works fine
 
6:15 PM
:(
not for me
with some is not working anything in my case
 
that would tell me that the string input matched none of the values
 
How is that possible ?
 
investigate what the values are and what the string input is
i would assume you took the .some portion and just threw it at your row values
when that logic is built around the array being your array of rows
 
filteredRowData = rows.filter, where .filter is my .filter above
 
6:28 PM
Maybe it's better to use separated logic just for dates
I don't know
and objValue && objValue?.toString().includes(key) for all others
 
objValue && objValue?. is redundant
eh
maybe not...
i don't think either is necessary
unless you can get undefined in your data?
i'd hope not
 
Why does it matter in this situation ?
 
it doesn't
it was commentary on your code
 
Help if you know how, if not ...
 
...
you're the one here begging for help every day with the same problem, lol
 
6:37 PM
What's wrong with that ?
What to do when noone know how to solve the same problem
 
all you're doing is filtering an array of objects,
that's easy
 
No it's not
we are talking about that few days
 
let me put it this way.
 
2
A: javascript filter array multiple conditions

Kaloyan StoyanovA clean and functional solution const combineFilters = (...filters) => (item) => { return filters.map((filter) => filter(item)).every((x) => x === true); }; then you use it like so: const filteredArray = arr.filter(combineFilters(filterFunc1, filterFunc2)); and filterFunc1 for example might...

 
1. You need to iterate over the array.
2. for each object in the array (row of the table), you need to loop over each value
3. If any of the values, as a string, matches the input value, return true for the row
 
6:40 PM
maybe like this ?
 
do you have multiple conditions?
 
I have, strings, numbers and text
 
those are multiple value types
 
I want to filter all of that
 
all you care about is whether or not any one of them match
 
6:41 PM
please see this solution
 
i see it
the problem is you don't have multiple filters. do you need multiple filters?
 
why
so, lets follow this logically
the user inputs a string. say, 25.
 
One for date , and one for all others (text, numbers)
 
your date is a string
the text is a string
the only value that isn't a string is your numbers, and they can be made into strings
multiple filters is for when you have multiple search inputs
you only have 1 input
 
6:44 PM
Oh, ok
15.toString() = '15'
return objValue && objValue?.toString().includes(key)
 
the one bit i see potentiall issue with is 31999.99 on your table is presented as "31'999.99"
if the user searches for 31'999 they won't find it
you could simply strip ' out of the input
 
it's not problem at all
everything works like a charm
expect the fucking date
expected faking dot from date
 
so, 26 finds the row
but 26. doesn't?
 
haha, I'm going to break something
 
does 26, find the row?
 
6:54 PM
4. from 454.14 is find
 
does 4,?
 
No
dot for all other column works except for date
 
then i don't trust that the data you're logging is the data being passed to the filter
 
what the faking fak
Do you have a solution ?
 
48 mins ago, by Kevin B
!!> [{foo: "2022.08.26", bar: 31999.99}].filter(obj => Object.values(obj).some(val => val.toString().includes('31999.99')))
if your data matches what you have provided, this would work
22, 22.08, and 2022.08.26 would all find that row
if it doesn't, then your date field doesn't contain "2022.08.26"
there's no other way around that
if it doesn't, it's because your row data doesn't match what you showed and would require some special code for the date fields
(which would require knowing what's actually stored in them)
 
7:07 PM
oh fuck
      return objValue && objValue?.toString().includes(key)
works
but reversed
instead of 22.08.2022. it's 2022.08.22
 
i mean
 
Now I see what's the problem
I changed this
but now dot does not work
not for numbers
 
7:34 PM
posted on September 28, 2022 by Prudhvikumar Bommana

  The dev channel has been updated to 107.0.5304.18 for Windows,Mac and Linux. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvikumar Bommana Google Chrome

 
7:45 PM
What's the problem with moment library
I have very very strange situation
 
7:57 PM
nothing, other than it's mostly not needed anymore
for a while it was the defacto date management library
 
 
2 hours later…
9:28 PM
Hey
One more question
I have an issue with motion.div AnimatePresense
what I would like to do is to use history.back or something similar from react router
BUT...
I am currently on /test page, and I click on some cards, and I change the query param /test/1 , or /test/2 or /test/3
Is there any way to jump from test/3 directly to test
history.back works in case when I want to go from test/3 to test/2 and so on
 
if you're ushing history.push to change to /1, /2, /3 etc, wouldn't .back take you back to /
isn't that kinda just how it works
 
just router.back or history.back works properly in my situation
because when I click , link to /test is not changed immediately but after few seconds
can I use history.back()
with param ?
 
9:59 PM
!!mdn history api
 
what param would you want to use?
 
I am not sure
do you have experience with motion.div
 
no
 
I have page where I have card stack animation
and when I want to change something on the top of window
and when I click, it's not triggered now , but after few seconds
because of animation etc.
 
 
1 hour later…
11:04 PM
posted on September 28, 2022 by Ben Mason

Hi everyone! We've just released Chrome Beta 107 (107.0.5304.18) for iOS; it'll become available on App Store in the next few days. You can see a partial list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Erhu Akpobaro Google Chrome

 

« first day (4365 days earlier)      last day (580 days later) »