Bhargava 6063bd1724 Help Project:
1. Initial Commit - a boiler plate code and POC to realize the concept of context
sensitive help
2. Frontend code written in ReactJS
3. Backend code written in Java, Spring Boot Framework
4. Frontend Start:
        pre-requisites : node, npm
	npm run dev  ==> to start the frontend vite server
5. Backend Start:
	pre-requisites : java, mvn
        mvn spring-boot:run  ==> to start the backend server
6. Visit http://localhost:5173/ for basic demo of help, press F1 in textboxes
7. Visit http://localhost:5173/editor and enter "admin123" to add/modify texts.

Happy Coding !!!

Thank you,
Bhargava.
2025-07-04 15:54:13 +05:30

66 lines
1.9 KiB
JavaScript

'use strict';
var test = require('tape');
var hasNames = require('../');
test('named functions', function (t) {
function f() {} // eslint-disable-line func-style
var g = function h() {};
t.equal(typeof hasNames, 'function', 'is a function');
t.equal(hasNames(), f.name === 'f' && g.name === 'h', 'functions have names or not as expected');
t.end();
});
var oDP = Object.defineProperty;
if (oDP) {
try {
oDP({}, 'a', { value: 1 });
} catch (e) {
oDP = null;
}
}
test('functionsHaveConfigurableNames', function (t) {
t.equal(typeof hasNames.functionsHaveConfigurableNames, 'function', 'is a function');
if (hasNames()) {
var fn = function f() {};
if (oDP) {
try {
oDP(fn, 'name', { configurable: true, value: 'foo' });
} catch (e) {}
if (fn.name === 'f') {
t.equal(hasNames.functionsHaveConfigurableNames(), false, 'function names are not configurable');
} else if (fn.name === 'foo') {
t.equal(hasNames.functionsHaveConfigurableNames(), true, 'function names are not configurable');
} else {
t.fail('functions have names, but something surprising has happened. Please report this!');
}
} else {
t.equal(hasNames.functionsHaveConfigurableNames(), false, 'function names are not configurable');
}
} else {
t.equal(hasNames.functionsHaveConfigurableNames(), false, 'functions do not have names');
}
t.end();
});
test('boundFunctionsHaveNames', function (t) {
t.equal(typeof hasNames.boundFunctionsHaveNames, 'function', 'is a function');
var fn = function f() {};
if (typeof fn.bind !== 'function') {
t.equal(hasNames.boundFunctionsHaveNames(), false, 'bound functions do not have names, because .bind does not exist');
} else if (hasNames()) {
t.equal(hasNames.boundFunctionsHaveNames(), fn.bind().name !== '', 'bound functions have names');
} else {
t.equal(hasNames.boundFunctionsHaveNames(), false, 'bound functions do not have names, because none do');
}
t.end();
});