require

How to add selectall using dropdownadapter on select2 v4

只愿长相守 提交于 2021-02-19 08:47:06
问题 I am not using require and trying to implement this. $(".js-example-data-ajax").select2({ ajax: { //url: "https://api.github.com/search/repositories", url: "<?=BASE_URL ?>api/corporate-performance-dashboard/get-customers", dataType: 'json', type : 'POST', delay: 250, data: function (params) { return { q: params.term, // search term page: params.page }; }, processResults: function (data, params) { // parse the results into the format expected by Select2 // since we are using custom formatting

Node.js: require() and MODULE_NOT_FOUND

烈酒焚心 提交于 2021-02-19 01:48:34
问题 As a learning exercise, I am attempting to build a router in Node.js, which is meant to be reusable. The file structure for my router looks like this: /myProject app.js /routes index.js about.js /modules /router router.js In app.js , I create a router object, and pass it the path to my routes folder: var Router = require('./modules/router/router'); var router = new Router('./routes'); Within the constructor of the router object, I load filenames into an array from the path passed to the

Node.js: require() and MODULE_NOT_FOUND

半城伤御伤魂 提交于 2021-02-19 01:48:30
问题 As a learning exercise, I am attempting to build a router in Node.js, which is meant to be reusable. The file structure for my router looks like this: /myProject app.js /routes index.js about.js /modules /router router.js In app.js , I create a router object, and pass it the path to my routes folder: var Router = require('./modules/router/router'); var router = new Router('./routes'); Within the constructor of the router object, I load filenames into an array from the path passed to the

Ignoring specific require()s in Webpack?

只谈情不闲聊 提交于 2021-02-18 08:01:42
问题 I have a library interoperable with NodeJS and the Browser and both are being run through Webpack to produce the final bundle. The issue I'm running into is Webpack will rewrite all require() statements to __webpack_require__() and try to bundle the library, which doesn't work for things like fs and worker_threads . How do I make it ignore certain require() s and related mechanisms ( require.resolve() , import , etc) given a specific input string? I've read that I can use the webpack

Ignoring specific require()s in Webpack?

本小妞迷上赌 提交于 2021-02-18 08:01:10
问题 I have a library interoperable with NodeJS and the Browser and both are being run through Webpack to produce the final bundle. The issue I'm running into is Webpack will rewrite all require() statements to __webpack_require__() and try to bundle the library, which doesn't work for things like fs and worker_threads . How do I make it ignore certain require() s and related mechanisms ( require.resolve() , import , etc) given a specific input string? I've read that I can use the webpack

Why can't I determine the path for require.context in a karma shim by passing a variable?

一个人想着一个人 提交于 2021-02-10 17:27:34
问题 I want to set the path for require.context(path, ...) in a shim file called by karma (set in the files parameter in the config) dynamically, but somehow, as soon as I use a variable for path, I get the error 'Cannot find module "."' in the CLI. This is very odd, because if I hardcode the very same path into the call, it runs without a problem. Aka, if I do var testPath = '../src'; console.log("PATH 2 " + testPath); // ../src var appContext = require.context(testPath, true, /\.spec\.ts/); I'll

Can you use ES2015+ features (ES6) in Adobe XD plugins?

≯℡__Kan透↙ 提交于 2021-02-10 13:33:09
问题 I'm building a plugin in Adobe XD. Can I use ES2015+ (ES6) features? For example, template literals, let , const , Arrow functions, asynchronous functions ( async / await )? 回答1: XD plugin APIs support most of ES2015 and beyond. You can use features such as: Template literals Classes Block-scoped variables ( let , const ) Object destructuring Default parameters Spread and Rest ( ... ) Arrow functions Asynchronous functions ( async / await ) Promises You can also use ES5 JavaScript features as

Node: requiring module inside function?

人盡茶涼 提交于 2021-02-08 12:22:19
问题 I was browsing the source code for a command line utility in Node, and saw the following code. function help() { var colors = require('colors'); var package = require('../package'); .... .... } I had not seen require being used inside a function in this way before. I always assumed it was best practice to include it at the top of the file. This is the entry file for this program, and this function is only called in a specific case--but those packages are used elsewhere in the program. When I

What do the last lines in Lua's `package.config` mean?

久未见 提交于 2021-02-07 13:46:57
问题 The Lua specs say about package.config (numbering added by me): The first line is the directory separator string. Default is ' \ ' for Windows and ' / ' for all other systems. The second line is the character that separates templates in a path. Default is ' ; '. The third line is the string that marks the substitution points in a template. Default is ' ? '. The fourth line is a string that, in a path in Windows, is replaced by the executable's directory. Default is ' ! '. The fifth line is a

Is there a way to replace script tag src with require and run the same script on node?

时光毁灭记忆、已成空白 提交于 2021-01-29 05:12:39
问题 I am running the following in a browser: INDEX.HTML (BODY) <script src="https://unpkg.com/@tensorflow/tfjs"></script> <script src="https://unpkg.com/@tensorflow/tfjs-automl"></script> <img id="daisy" crossorigin="anonymous" src="https://storage.googleapis.com/tfjs-testing/tfjs-automl/img_classification/daisy.jpg" /> <script> async function run() { const model = await tf.automl.loadImageClassification("model.json"); const image = document.getElementById("daisy"); const predictions = await