Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuclide-commons

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuclide-commons - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

25

collection.js

@@ -13,2 +13,3 @@ "use strict";

exports.mapUnion = mapUnion;
exports.mapCompact = mapCompact;
exports.mapFilter = mapFilter;

@@ -23,2 +24,3 @@ exports.mapTransform = mapTransform;

exports.setDifference = setDifference;
exports.setFilter = setFilter;
exports.isEmpty = isEmpty;

@@ -125,2 +127,12 @@ exports.keyMirror = keyMirror;

function mapCompact(map) {
const selected = new Map();
for (const [key, value] of map) {
if (value != null) {
selected.set(key, value);
}
}
return selected;
}
function mapFilter(map, selector) {

@@ -183,3 +195,3 @@ const selected = new Map();

function setIntersect(a, b) {
return new Set(Array.from(a).filter(e => b.has(e)));
return setFilter(a, e => b.has(e));
}

@@ -214,2 +226,13 @@

function setFilter(set, predicate) {
const out = new Set();
for (const item of set) {
if (predicate(item)) {
out.add(item);
}
}
return out;
}
/**

@@ -216,0 +239,0 @@ * O(1)-check if a given object is empty (has no properties, inherited or not)

@@ -8,2 +8,4 @@ 'use strict';

var _asyncToGenerator = _interopRequireDefault(require('async-to-generator'));
var _lruCache;

@@ -37,4 +39,4 @@

constructor(configFileName) {
this._configFileName = configFileName;
constructor(configFileNames) {
this._configFileNames = configFileNames;
this._configCache = (0, (_lruCache || _load_lruCache()).default)({

@@ -46,10 +48,27 @@ max: 200, // Want this to exceed the maximum expected number of open files + dirs.

getConfigDir(path) {
if (!this._configCache.has(path)) {
const result = (_fsPromise || _load_fsPromise()).default.findNearestFile(this._configFileName, path);
let result = this._configCache.get(path);
if (result == null) {
result = this._findConfigDir(path);
this._configCache.set(path, result);
return result;
}
return this._configCache.get(path);
return result;
}
_findConfigDir(path) {
var _this = this;
return (0, _asyncToGenerator.default)(function* () {
const configDirs = yield Promise.all(_this._configFileNames.map(function (configFile) {
return (_fsPromise || _load_fsPromise()).default.findNearestFile(configFile, path);
}));
// Find the result with the greatest length (the closest match).
return configDirs.filter(Boolean).reduce(function (previous, configDir) {
if (previous == null || configDir.length > previous.length) {
return configDir;
}
return previous;
}, null);
})();
}
dispose() {

@@ -56,0 +75,0 @@ this._configCache.reset();

2

package.json
{
"name": "nuclide-commons",
"version": "0.1.8",
"version": "0.1.9",
"description": "Common Nuclide node modules.",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc