Skip to content

Commit

Permalink
Merge branch 'master' into matux/prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
matux committed Mar 7, 2024
2 parents 0401854 + 71b5e3a commit a3a204b
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 163 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Rollbar.js CI

on:
push:
branches: [ master ]
tags: [ v* ]
branches: [master]
tags: [v*]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:
Expand All @@ -15,15 +15,15 @@ jobs:
matrix:
include:
- node: 14
npm: 8
npm: ^8
- node: 16
npm: 8
npm: ^8
- node: 18
npm: 9
npm: ^9
- node: 20
npm: 10
- node: 21
npm: 10
npm: ^10
- node: latest
npm: latest

steps:
- name: Checkout
Expand All @@ -37,7 +37,7 @@ jobs:
node-version: ${{ matrix.node }}

- name: Update npm
run: npm install -g npm@^${{ matrix.npm }}
run: npm install -g npm@${{ matrix.npm }}

- name: npm install
run: npm install
Expand Down
9 changes: 1 addition & 8 deletions src/browser/telemetry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var _ = require('../utility');
var headers = require('../utility/headers');
var replace = require('../utility/replace');
var scrub = require('../scrub');
var urlparser = require('./url');
var domUtil = require('./domUtility');
Expand All @@ -21,14 +22,6 @@ var defaults = {
errorOnContentSecurityPolicy: false,
};

function replace(obj, name, replacement, replacements, type) {
var orig = obj[name];
obj[name] = replacement(orig);
if (replacements) {
replacements[type].push([obj, name, orig]);
}
}

function restore(replacements, type) {
var b;
while (replacements[type].length) {
Expand Down
15 changes: 1 addition & 14 deletions src/server/telemetry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var http = require('http');
var https = require('https');
var _ = require('../utility');
var replace = require('../utility/replace');
var urlHelpers = require('./telemetry/urlHelpers');

var defaults = {
Expand Down Expand Up @@ -185,20 +186,6 @@ Instrumenter.prototype.instrumentConsole = function () {
);
};

// TODO: These helpers are duplicated in src/browser/telemetry.js,
// and may be candidates for extraction into a shared module.
// It is recommended that before doing so, the author should allow
// for more telemetry types to be implemented for the Node target
// to ensure that the implementations of these helpers don't diverge.
// If they do diverge, there's little point in the shared module.
function replace(obj, name, replacement, replacements, type) {
var orig = obj[name];
obj[name] = replacement(orig);
if (replacements) {
replacements[type].push([obj, name, orig]);
}
}

function restore(replacements, type) {
var b;
while (replacements[type].length) {
Expand Down
9 changes: 9 additions & 0 deletions src/utility/replace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function replace(obj, name, replacement, replacements, type) {

Check failure on line 1 in src/utility/replace.js

View workflow job for this annotation

GitHub Actions / Prettier

src/utility/replace.js#L1

There are issues with this file's formatting, please run Prettier to fix the errors
var orig = obj[name];
obj[name] = replacement(orig);
if (replacements) {
replacements[type].push([obj, name, orig]);
}
}

module.exports = replace;
Loading

0 comments on commit a3a204b

Please sign in to comment.