草庐IT

find_module

全部标签

javascript node module.exports/require() 前端代码

我一直在研究使用像SVGO这样的库能够在前端清理用户提交的SVG代码。SVGO是一个基于node.js的库,通常在后端运行,所以我一直在努力思考如何将SVG代码从前端发送到后端,然后将清理过的代码反刍到前端。正是在我试图弄清楚这一点的时候,我检查了他们的webappexample,经检查,在链接脚本中运行代码,我通常会在前端的后端看到这些代码。特别是,它们的许多函数都具有签名(fullscript):1:[function(require,module,exports){"usestrict";varloadScripts=require("./load-scripts"),...mo

javascript - TS1148 ~ 如何使用 --module : "import" and typescript 2. x "none"

我目前正在使用一些旧版JavaScript开发一个项目。该应用程序不包含模块加载器,它只是将所有内容作为全局变量放入window对象中。遗憾的是,接触遗留代码并包含模块加载器对我来说不是一个可行的选择。我想在我自己的代码中使用typescript。我设置了typescript编译器选项module:"none"在我的tsconfig.json中,我只使用命名空间来组织我自己的代码。到目前为止效果很好。..到现在为止:import*asRxfrom'rxjs';..Rx.Observable.from(['foo',bar']);...//ResultsinTypeScript-Erro

javascript - import {module} 和 import module 的区别

这个问题在这里已经有了答案:`exportconst`vs.`exportdefault`inES6(6个答案)usingbracketswithjavascriptimportsyntax(2个答案)WhenshouldIusecurlybracesforES6import?(11个答案)关闭5年前。我看到了以下两种从ES6中的另一个模块导入代码的变体:import{module}from"./Module"和importmodulefrom"./Module"其中module是文件中定义的ES6类Module.js这两个导入语句有什么区别?

javascript - Angular : Mixing provider and custom service in module's config/run

我想做这样的事情:angular.module('app',[]).config(['$httpProvider','customAuthService',($httpProvider,customAuthService)->$httpProvider.defaults.transformRequest.push(data)->ifcustomAuthService.isLoggedIndata['api_key']={token:@token}])根据Angularjsdoc,我不能在我的module的configblock中执行此操作,因为那里不允许自定义服务,我也不能在run中执

javascript - es6-module 默认导出导入为未定义

我不确定我在这里遗漏了什么。我正在使用jspm和es6-module-loader开发一个项目。我有一个定义如下的模块:importhooksfrom'./hooks';importapifrom'./api';importtoolsfrom'./tools';constStencilUtils={hooks:hooks,api:api,tools:tools,};export{hooks,api,tools};exportdefaultStencilUtils;/*globaldefine*/(function(root){if(typeofdefine==='function'&&

javascript - React-Redux/Jest 不变违规 : Could not find "store"

我设置了一个简单的测试文件,几乎与create-react-app使用的文件相同:App.test.jsimportReactfrom'react';importReactDOMfrom'react-dom';import{App}from'./App';it('renderswithoutcrashing',()=>{constdiv=document.createElement('div');ReactDOM.render(,div);});当我运行yarntest我不断收到此错误消息:InvariantViolation:Couldnotfind"store"ineitherth

javascript - 错误 : "Cannot find module" while running firebase cloud function

constfunctions=require('firebase-functions');varnodemailer=require('nodemailer');//constexpress=require('express');vartransporter=nodemailer.createTransport('smtps://username@gmail.com:password5@smtp.gmail.com');exports.sendMail=functions.https.onRequest((req,res)=>{varmailOptions={to:'receiver@

javascript - typescript : find date difference in dates/hours/minutes

我正在进行日期比较,我正在尝试以日期、小时、分钟的格式计算和显示两个日期之间的差异...日期值存储在数据库中,如下所示:EndDate:2018-11-2910:49:49.9396033PurchaseDate:2018-11-2910:49:07.4154497在我的Angular组件中,我有:letresult=newDate(res.endDate).valueOf()-newDate(res.purchaseDate).valueOf();这导致:42524我不确定它代表什么。我想知道计算两个日期之间时差的正确方法是什么,以及如何以正确且可读的方式显示结果。欢迎任何帮助

javascript - jQuery Find() 和 XML 在 IE 中不起作用

我正在尝试使用jQuery来解析内存中的XML文档。这在除IE(令人震惊的)以外的所有方面都很好用。一些谷歌搜索显示问题很可能是由于IE将我的文档视为HTML而不是XMLMIME类型。有没有办法让我的jQuery实现正常工作,或者我是否必须检查客户端浏览器并实现IE特定的XML解析?谢谢!!functiongetQAData(xmlData){vardataArr=newArray();$(xmlData).find('item').each(function(){dataArr.push({questionid:$(this).attr("cellID"),answer:$(this

javascript - 用 window.find() 匹配所有出现的地方

例如,如果我有一个如下所示的HTML网页HelloTechies,Techieshere.如果我使用搜索“Techies”varsel=window.getSelection();sel.collapse(document.body,0);document.body.offsetHeight;if(window.find("Techies",true)){document.execCommand("hiliteColor",false,"YellowGreen");sel.collapseToEnd();}它仅突出显示“技术人员”的第一次出现。但是当我使用Ctrl+F搜索时,第一个出现