JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Sep 4 12:41
@ParkingMaster yes
Aug 14 09:32
@matt eval? You're insane
Jun 21 07:45
@1.21gigawatts You can do that with Actions
Jun 20 14:17
Haha I think I get you, so you can break out a bit of text into a new tab, but it will hold its place in the original document?
Jun 20 14:10
Fair, but we have so many utility methods that don't need re-inventing 😛
Jun 20 14:06
It's also functionally very different from var
Jun 20 14:05
:(
Jun 20 14:03
Like I understand what you're going for
Jun 20 14:02
function rd(name) {
      return txt.find(t => t.name === name).txt;
}
Jun 20 14:01
Your rd function could be dumbed down to something like
Jun 20 14:00
Mixing global variables
Jun 20 13:59
Variable re-use, two letter function names, a fair few parts can be replaced with already established JS methods
Jun 20 13:55
Inconsistent and unreadable among other things
Jun 20 13:52
That's some awful looking code
May 3 14:18
Unsubscribe
May 3 12:36
ok?
May 2 13:39
@underscore Are all the typos to catch the plagiarism bots? 😂
May 2 13:35
@CommonMan What's to comment? You've accepted an answer lol
Feb 12 15:05
Feb 12 15:05
You can add a global blur breakpoint and should be able to backtrack from there
Feb 12 14:58
You can add a breakpoint with the debugger and step through it
Jan 22 10:52
SO chat never changes
Sep 22, 2023 12:53
If it works it works, but it's not the right way
Sep 22, 2023 12:51
similar might not be good enough
Sep 22, 2023 12:51
Unless you have the exact same setup (same node version, same package.json & package-lock.json)
Sep 22, 2023 12:50
I would advise against that
Sep 22, 2023 12:48
Not always though
Sep 22, 2023 12:47
Generally prefixed with an @
Sep 22, 2023 12:44
You have a private package in your package.json that requires authenticating with npmjs.com
Sep 22, 2023 12:43
It's almost like reading is a necessary skill
Sep 22, 2023 12:38
uh
Aug 23, 2023 15:17
with(obj) {... is still my favourite though
Aug 23, 2023 15:05
tagged template literals, just splits up the string if it detects a tagged variable
Aug 23, 2023 14:48
Boredom prevails
Aug 23, 2023 14:48
const values = ['Banana','Yellow','Columbia'];
const keys = ['Fruit','Color','Producer'];

const obj = Object.fromEntries(keys.map((key, index) => [key, values[index]]));

const getRow = (obj) => {
	return (strings, ...values) => {
		return strings.reduce((result, string, index) => {
      result += string + (obj[values[index]] || '');
      return result;
    }, '');
  }
}

console.log(getRow(obj)`The <b>${"Fruit"}/b> you are eating is ${"Color"} and was produced in ${"Producer"}`);
Aug 23, 2023 14:20
@Cerbrus Going to reply with a with answer 😂
 

Sandbox

Where you can play with regular chat features (except flagging...
Aug 23, 2023 08:04
3
Q: AWS Lambda credentials from the execution environment do not have the execution role's permissions

ZeroMaxI am deploying an AWS lambda function (with nodejs 12.x) that executes an AWS command ("iot:attachPrincipalPolicy") when invoked. I'm taking the credentials to run this command from the lambda execution environment variables. const AWS = require('aws-sdk/global'); const region = process.env[...

Aug 23, 2023 08:04
You might be okay
Aug 23, 2023 08:00
It has the permissions of the IAM user it's being run as, assuming it's been setup properly
Aug 23, 2023 07:55
> const ctx = { x: 2 };
undefined
> vm.createContext(ctx)
{ x: 2 }
> vm.runInContext('console.log(process.ENV)', ctx)
evalmachine.<anonymous>:1
console.log(process.ENV)
            ^

Uncaught ReferenceError: process is not defined
    at evalmachine.<anonymous>:1:13
    at Script.runInContext (node:vm:140:12)
    at Object.runInContext (node:vm:290:6)
    at REPL79:1:4
    at Script.runInThisContext (node:vm:128:12)
    at REPLServer.defaultEval (node:repl:570:29)
    at bound (node:domain:433:15)
Aug 23, 2023 07:52
AWS session tokens for a start
Aug 23, 2023 07:51
@Wietlol
Aug 23, 2023 07:51
Needs to be using isolated VMs lol
Aug 23, 2023 07:50
1 message moved to Trash can
Aug 23, 2023 07:49
yikes
Aug 23, 2023 07:49
!evalnode console.log(JSON.stringify(process.env))
Aug 23, 2023 07:49
!evalnode console.log(process.env)
 

Trash can

Like the recycle bin, but trashier.
Aug 23, 2023 07:50
1 message moved from Sandbox