草庐IT

unused-functions

全部标签

javascript - 类型错误 : scrollIntoView is not a function

我是react-testing-library/jest的新手,正在尝试编写测试以查看路由导航(使用react-router-dom)是否正确执行。到目前为止,我一直在关注README还有这个tutorial关于如何使用。我的一个组件在本地函数中使用了scrollIntoView,这导致测试失败。TypeError:this.messagesEnd.scrollIntoViewisnotafunction45|46|scrollToBottom=()=>{>47|this.messagesEnd.scrollIntoView({behavior:"smooth"});|^48|}49|

javascript - TypeError [ERR_INVALID_ARG_TYPE] : The "original" argument must be of type Function. 接收类型未定义

在下面的代码中,我得到了这个错误:TypeError[ERR_INVALID_ARG_TYPE]:The"original"argumentmustbeoftypeFunction.Receivedtypeundefinedconstsqlite3=require('sqlite3').verbose();constutil=require('util');asyncfunctiongetDB(){returnnewPromise(function(resolve,reject){letdb=newsqlite3.Database('./project.db',(err)=>{if(e

javascript - 在 nodejs 上访问 function.caller

我有一项任务依赖于function.caller来完整性检查调用者是否获得授权。根据这个url,所有主流浏览器都支持caller...并且我的所有单元测试都通过了:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/caller但是,nodejs拒绝所有访问function.caller的尝试(将其报告为null)。我愿意接受让这个在nodejs上工作的建议...我不希望这个框架只在浏览器上工作。谢谢! 最佳答案

javascript - Babel/Karma/Chai 给出 TypeError : 'caller' , 'callee' 和 'arguments' properties may not be accessed on strict mode functions

我无法弄清楚为什么这个测试没有通过。varexpect=require('chai').expect;describe('HelloComponent',function(){it('passesaquitesimpletest',function(){expect(1+4).to.equal(5);});});产生这个错误:DEBUG[web-server]:serving:/Users/ivan/dev/react-starter/node_modules/karma/static/context.htmlDEBUG[web-server]:serving(cached):/Use

javascript - 无效值错误 : initAutocomplete is not a function Google Places and Autocomplete API

希望您能提供帮助,因为我遇到了困难,我对使用Google的PlacesAPI也很陌生。我现在不打算发布任何代码,因为当我将要描述的2部分独立运行时,我的代码工作正常。除了使用Google提供的Javascript示例的自动完成API之外,我还使用Google的Places。最初我的文档底部有以下脚本:我文档顶部的这个脚本:这让我想到,“您已在此页面上多次包含GoogleMapsAPI。这可能会导致意外错误。”所以在研究了这个之后,我像这样将两者合并在一起:但是,既然我已经这样做了,我会收到以下错误:InvalidValueError:initAutocompleteisnotafunc

javascript - Google Cloud Functions 和 AWS Lambda 的超时问题

我们使用NodeJS来处理使用GoogleSpeech-to-TextAPI的长转录本。许多功能需要10分钟以上的时间来处理。处理/音频时间的通常比率约为50%。因此,处理一个20分钟的FLAC音频文件大约需要10分钟(因此在GoogleCloudFunctions上失败,最长时间为540秒或9分钟),而在AWSLambda上超过29分钟的任何文件都会失败。每个平台上都有哪些服务可以处理超过20/30分钟的音频文件,还允许发送事件数据并调用应用程序?如何混合使用云功能和其他平台来处理成绩单? 最佳答案 我不知道AWS以外的其他云提供

javascript - Y 组合器 : Some functions do not have fixed points

WikipediaarticleontheYcombinator提供了Y组合器的以下JavaScript实现:functionY(f){return((function(x){returnf(function(v){returnx(x)(v);});})(function(x){returnf(function(v){returnx(x)(v);});}));}JavaScript中Y组合器的存在意味着每个JavaScript函数都有一个不动点(因为对于每个函数g、Y(g)和g(Y(g))应该相等)。但是,不难想出违反Y(g)=g(Y(g))的不带不动点的函数(参见here)。甚至某些

javascript - '类型错误 : undefined is not a function' when jumping 'tween modules

我在Node中不断遇到这个问题,每当我相互调用函数时,我的应用程序就会崩溃。我已经做了这个最小的工作示例(按照它的方式工作给了我错误):启动模块varmodule2=require('./module2');vardata='data';module2.doStuff(data);模块2varmodule3=require('./module3');functiondoStuff(data){//Stuffhappensto'data'module3.takeStuff(data);}functiondoSomethingElse(data){console.log(data);}mo

javascript - JSHINT:如何禁用匿名 'function' 后缺少空格的警告

我在jshint中收到了警告'[L76:C24]Missingspaceafter'function''我遵循NicholasZakkasMaintainablejavascript风格,匿名函数后没有空格。如何在jshint中删除此警告?.jshintrc{"node":true,"browser":true,"es5":true,"esnext":true,"bitwise":true,"camelcase":true,"curly":true,"eqeqeq":true,"immed":true,"indent":4,"latedef":true,"newcap":true,"n

javascript - 类型错误 : module is not a function AngularJS & Jasmine

在我的示例应用程序中,我像这样测试运行器收藏夹Controller:varmodule=angular.module('AngularSampleApp',[]);varFavoritesController=module.controller('FavoritesController',functionfavoritesController($scope){$scope.phones=[{'name':'NexusS','snippet':'FastjustgotfasterwithNexusS.'},{'name':'MotorolaXOOM™withWi-Fi','snippet