// register as 'classnames', consistent with npm package name define('classnames', [],function() { returnclassNames; }); }else{ window.classNames= classNames; } 2.bind功能 在官方的文档中,bind版本给出的是在使用css-modules方式,或者抽象类和实际输出到DOM的真实类做映射的方式,可能需要使用bind...
源码片段 describe('classNames',function(){it('keeps object keys with truthy values',function(){assert.equal(classNames({a:true,b:false,c:0,d:null,e:undefined,f:1}),'a f');});it('joins arrays of class names and ignore falsy values',function(){assert.equal(classNames('a',0,null,...
To use the dedupe version with Node.js, Browserify, or webpack: constclassNames=require('classnames/dedupe');classNames('foo','foo','bar');// => 'foo bar'classNames('foo',{foo:false,bar:true});// => 'bar' For standalone (global / AMD) use, includededupe.jsin a<script>tag ...
将classNames 挂载到 window 上 if(typeofmodule!=='undefined'&&module.exports){classNames.default=classNames;module.exports=classNames;}elseif(typeofdefine==='function'&&typeofdefine.amd==='object'&&define.amd){// register as 'classnames', consistent with npm package namedefine('classnames',[...
added a new bind variant for use with css-modules and similar abstractions, thanks to Kirill Yakovenko v2.1.5 / 2015-09-30 reverted a new usage of Object.keys in dedupe.js that slipped through in the last release v2.1.4 / 2015-09-30 new case added to benchmarks safer hasOwnProperty...
To use the dedupe version with node, browserify or webpack: varclassNames=require('classnames/dedupe');classNames('foo','foo','bar');// => 'foo bar'classNames('foo',{foo:false,bar:true});// => 'bar' For standalone (global / AMD) use, includededupe.jsin a<script>tag on your...
I'm not sure my changes fit with the authors intent for classnames-loader as it does more than just classnames binding, so decided to fork and rename the project.This module will bind exports to classnames, but also used with css-modules, will include the normal and module name so both...
To use the dedupe version with node, browserify or webpack:var classNames = require('classnames/dedupe'); classNames('foo', 'foo', 'bar'); // => 'foo bar' classNames('foo', { foo: false, bar: true }); // => 'bar'
Convert markdown to JSX with ease for React and React-like projects. Super lightweight and highly configurable. probablyup •7.7.4•a month ago•519dependents•MITpublished version7.7.4,a month ago519dependentslicensed under $MIT
To use the dedupe version with Node.js, Browserify, or webpack:var classNames = require('classnames/dedupe'); classNames('foo', 'foo', 'bar'); // => 'foo bar' classNames('foo', { foo: false, bar: true }); // => 'bar'...