首页 \ 问答 \ 传递参数(Passing down arguments)

传递参数(Passing down arguments)

由于我的js类的性质,我有一个共同的参数分割器。 我无法弄清楚如何applycall此functin并传递arguments对象而不实际将其作为函数的参数传递。

function splitArgs(){
   return {
       text : arguments[0],
       class : arguments[1] || ""  
   }
}

function doSomething(){
    var args = splitArgs.call(this, arguments);
    if(args.class)
      // do stuff
}

我努力了

splitArgs.call(this, arguments);

splitArgs.call(this, ...arguments);

splitArgs.apply(this, arguments);

splitArgs.apply(this, ...arguments);

splitArgs(...arguments);


I have a common argument splitter due to the nature of my js class. I cannot figure out how to apply, or call, this functin and pass the arguments object without actually passing it as an argument of the function.

function splitArgs(){
   return {
       text : arguments[0],
       class : arguments[1] || ""  
   }
}

function doSomething(){
    var args = splitArgs.call(this, arguments);
    if(args.class)
      // do stuff
}

I have tried

splitArgs.call(this, arguments);

splitArgs.call(this, ...arguments);

splitArgs.apply(this, arguments);

splitArgs.apply(this, ...arguments);

splitArgs(...arguments);


原文:https://stackoverflow.com/questions/38518112
更新时间:2022-07-24 21:07

最满意答案

我检查了maven transitive依赖项,并看到xerces包含在多个库中,包括Apache Abdera

要解决此错误,我通过排除xerces依赖关系来更新依赖关系配置,如下所示:

    <dependency>
        <groupId>org.apache.abdera</groupId>
        <artifactId>abdera-parser</artifactId>
        <version>1.1.3</version>
        <exclusions>
            <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

I checked maven transitive dependencies and saw that xerces is included by multiple libraries including Apache Abdera.

To resolve this error, I updated dependency configuration by excluding xerces dependency as follows:

    <dependency>
        <groupId>org.apache.abdera</groupId>
        <artifactId>abdera-parser</artifactId>
        <version>1.1.3</version>
        <exclusions>
            <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

相关问答

更多
  • java.lang.AbstractMethodError 这意味着当前类路径中在API中声明的抽象方法缺少当前类路径中的具体实现。 org.apache.xalan.processor.TransformerFactoryImpl.setFeature(Ljava /郎/字符串; Z)V 这是从Java SE 5.0开始引入的。 因此,此异常表明当前类路径中的API至少是Java SE 5.0,具体实现与此不兼容。 Xalan 2.7.0是第一个实现它的版本。 因此,你在类路径的某个地方有一个旧版本的Xa ...
  • 您可能知道,AbstractMethodError有时会由JAR不兼容引起。 我尝试了自己的gradle构建,并通过查看WAR文件找到了可能导致此问题的事情: 你使用旧版本的hibernate-envers。 你没有要求这个,但你声明对spring-data-envers的依赖(因此spring-data-envers需要hibernate-envers JAR),这可能导致问题。 我看到你有bcmail-jdk14-138.jar,bcprov-jdk14-138.jar和stax-api-1.0.x.j ...
  • 我检查了maven transitive依赖项,并看到xerces包含在多个库中,包括Apache Abdera 。 要解决此错误,我通过排除xerces依赖关系来更新依赖关系配置,如下所示: org.apache.abdera abdera-parser 1.1.3
  • 原来我不得不补充: validationQuery="select 1" 在context.xml中的资源声明中。 这里提到了这一点(虽然拼错为validateQuery )。 挖掘JtdsConnection的实现可以看到: /* (non-Javadoc) * @see java.sql.Connection#isValid(int) */ public boolean isValid(int timeout) throws SQLException { // TODO Auto-gene ...
  • 如果在WebSphere Application Server上运行应用程序,则应将Connections Server导入CellDefaultTrustSTore。 您可以将安全证书引用到https://www-01.ibm.com/support/knowledgecenter/SSYGQH_5.0.0/admin/install/t_exchange_keys_network.dita Log into the IBM WebSphere Application Server Integrated ...
  • 当您用于编译的jar与服务器运行代码时引用的jar之间不兼容时,抛出AbstractMethodError。 http://docs.oracle.com/javase/7/docs/api/java/lang/AbstractMethodError.html “当应用程序尝试调用抽象方法时抛出。通常,编译器会捕获此错误;如果自上次编译当前执行的方法以来某些类的定义发生了不兼容的更改,则此错误只能在运行时发生。 这可能是由于hibernate-search和hibernate-entity-manager的 ...
  • (1)常春藤文件不必列出每个jar。 有些罐子是其他罐子的依赖品,并且是由常春藤从储存库中自动提取的。 没有默认值可用。 对于一个新项目,我通常生成我的第一个常春藤文件(参见附件中的ant2ivy脚本) (2)当jar具有依赖关系时,只在常春藤存储库中需要常春藤文件。 说过拥有一个是好的做法。 我个人欺骗并使用像Nexus这样的Maven存储库管理器存储我的罐子。 (3)您可以使用文件系统解析程序在设置文件中创建本地存储库,如下所示:
  • 只是添加以防有人面临问题。 我通过以下链接解决了这个问题 Just adding in case it someone face the issue. I resolved the issue by following this link
  • 你指的文章说的是 该代码适用于Spring Boot 1.2.2和Hibernate 4.5 从你的日志看起来你正在使用Spring Boot 1.4.2,它将获取Hibernate 5罐。 Hibernate 5和旧版jadira存在一些问题(您使用的是3.1.0.CR1)。 自5.0.0.GA发布的jadira usertype以来,此问题已得到修复。 您能否尝试使用新版本https://mvnrepository.com/artifact/org.jadira.usertype/usertype.co ...
  • / project / distributionManagement是您上传自己的工件的地方。 对于依赖项解析,您必须使用/ project / repositories /project/distributionManagement is where your own artifacts will be uploaded. For dependency resolution, you must use /project/repositories

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)