Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address nits
  • Loading branch information
jasnell committed Apr 30, 2016
commit ec16e916dfb21340e17a74d1b9246f503e47bffb
16 changes: 0 additions & 16 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,22 +478,6 @@ util.isPrimitive(new Date())
// false
```

## util.isProxy(object)

Returns `true` if the given "object" is a `Proxy` object. Otherwise, returns
`false`.

```js
const util = require('util');
const proxyObj = new Proxy({}, {get: () => { return 5; }});

util.isProxy(proxyObj);
// true

util.isProxy({});
// false
```

## util.isRegExp(object)

Stability: 0 - Deprecated
Expand Down
7 changes: 1 addition & 6 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function inspectPromise(p) {

function formatValue(ctx, value, recurseTimes) {

if (isProxy(value)) {
if (binding.isProxy(value)) {
return 'Proxy ' + formatValue(ctx,
binding.getProxyDetails(value),
recurseTimes);
Expand Down Expand Up @@ -792,11 +792,6 @@ exports.isPrimitive = isPrimitive;

exports.isBuffer = Buffer.isBuffer;

function isProxy(p) {
return binding.isProxy(p);
}
exports.isProxy = isProxy;

function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
Expand Down
6 changes: 2 additions & 4 deletions test/parallel/test-util-inspect-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const handler = {
};
const proxyObj = new Proxy(target, handler);

assert.strictEqual(util.isProxy(proxyObj), true);

// Inspecting the proxy should not actually walk it's properties
assert.doesNotThrow(() => util.inspect(proxyObj));

// getProxyDetails is an internal method, not intended for public use.
// This is here to test that the internals are working correctly.
const details = processUtil.getProxyDetails(proxyObj);
assert.deepStrictEqual(target, details.target);
assert.deepStrictEqual(handler, details.handler);
Expand All @@ -25,5 +25,3 @@ assert.strictEqual(util.inspect(proxyObj),

// Using getProxyDetails with non-proxy returns undefined
assert.strictEqual(processUtil.getProxyDetails({}), undefined);
// isProxy with non-Proxy returns false
assert.strictEqual(util.isProxy({}), false);