You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var isOldIE = function isOldIE() {
var memo;
return function memorize() {
if (typeof memo === 'undefined') {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
memo = Boolean(window && document && document.all && !window.atob);
}
return memo;
};
}();
That ~~ is a double NOT bitwise operator.
It is used as a faster substitute for Math.floor() for positive numbers. It does not return the same result as Math.floor() for negative numbers, as it just chops off the part after the decimal (see other answers for examples of this).
Worth noting that it differs from .floor() in that it actually just removes anything to the right of the decimal. This makes a difference when used against a negative number. Also, it will always return a number, and will never give you NaN. If it can't be converted to a number, you'll get 0.
单例模式,缓存内容
node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js 开头就有一段代码很有代表性,可以生成一个缓存,或者说单例。
这段代码的模式可以借鉴,作为缓存或者单例模式的应用。
写函数文档的一种方式
以后写一个方法的文档可以使用这种方式,可选参数,参数类型都很清楚,从 webpack 的 loader interface 文档中借鉴来的: https://webpack.js.org/api/loaders/
转成驼峰名称的方式, camelCase
驼峰转中划线
~~ 操作
看大数相加算法的时候,看到了这个操作符。见 JavaScript-Algorithms/issues/32 的第一个回答。
what-is-the-double-tilde-operator-in-javascript
获取 package-lock.json 中所有依赖的 license
可以考虑写成一个 npm 包,发布到 npm 仓库里。
The text was updated successfully, but these errors were encountered: