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

fbjs

Package Overview
Dependencies
Maintainers
8
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fbjs - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

31

CHANGELOG.md
## [Unreleased]
## [0.8.3] - 2016-05-25
### Added
- `Deferred`: added `Deferred.prototype.catch` to avoid having to call this directly on the Promise.
- `UnicodeUtilsExtra`: added several methods for escaping strings.
### Changed
- More Flow annotations: `containsNode`, `emptyFunction`, `memoizeStringOnly`
- Added explicit `<any>` type arguments to in anticipation of a future Flow change requiring them.
- `Object.assign` calls now replaced with usage of `object-assign` module.
### Fixed
- Type imports in .js.flow files are now properly using relative paths.
- `DataTransfer`: handle Firefox better
## [0.8.2] - 2016-05-05
## Removed
### Removed
- Removed extraneous production dependency

@@ -11,3 +28,3 @@

## Added
### Added
- We now include a `Promise` class definition in `flow/lib` to account for the changes in Flow v0.23 which removed non-spec methods. This will allow our code to continue typechecking while using these methods.

@@ -39,2 +56,3 @@

## [0.7.1] - 2016-02-02

@@ -46,2 +64,3 @@

## [0.7.0] - 2016-01-27

@@ -61,2 +80,3 @@

## [0.6.1] - 2016-01-06

@@ -67,2 +87,3 @@

## [0.6.0] - 2015-12-29

@@ -73,2 +94,3 @@

## [0.5.1] - 2015-12-13

@@ -79,2 +101,3 @@

## [0.5.0] - 2015-12-04

@@ -86,2 +109,3 @@

## [0.4.0] - 2015-10-16

@@ -93,2 +117,3 @@

## [0.3.2] - 2015-10-12

@@ -99,2 +124,3 @@

## [0.3.1] - 2015-10-01

@@ -105,2 +131,3 @@

## [0.3.0] - 2015-10-01

@@ -107,0 +134,0 @@

8

lib/containsNode.js

@@ -11,3 +11,3 @@ 'use strict';

*
* @typechecks
*
*/

@@ -21,6 +21,2 @@

* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/

@@ -36,3 +32,3 @@ function containsNode(outerNode, innerNode) {

return containsNode(outerNode, innerNode.parentNode);
} else if (outerNode.contains) {
} else if ('contains' in outerNode) {
return outerNode.contains(innerNode);

@@ -39,0 +35,0 @@ } else if (outerNode.compareDocumentPosition) {

@@ -44,3 +44,3 @@ 'use strict';

*/
addClass: function (element, className) {
addClass: function addClass(element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : void 0;

@@ -65,3 +65,3 @@

*/
removeClass: function (element, className) {
removeClass: function removeClass(element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : void 0;

@@ -88,3 +88,3 @@

*/
conditionClass: function (element, className, bool) {
conditionClass: function conditionClass(element, className, bool) {
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);

@@ -100,3 +100,3 @@ },

*/
hasClass: function (element, className) {
hasClass: function hasClass(element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : void 0;

@@ -116,3 +116,3 @@ if (element.classList) {

*/
matchesSelector: function (element, selector) {
matchesSelector: function matchesSelector(element, selector) {
var matchesImpl = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || function (s) {

@@ -119,0 +119,0 @@ return matchesSelector_SLOW(element, s);

@@ -127,3 +127,3 @@ 'use strict';

return this.types.some(function (type) {
return type.indexOf('Url') != -1 || type.indexOf('text/uri-list') != -1;
return type.indexOf('Url') != -1 || type.indexOf('text/uri-list') != -1 || type.indexOf('text/x-moz-url');
});

@@ -141,2 +141,6 @@ };

if (this.data.getData) {
if (this.types.indexOf('text/x-moz-url') != -1) {
var url = this.data.getData('text/x-moz-url').split('\n');
return url[0];
}
return this.types.indexOf('text/uri-list') != -1 ? this.data.getData('text/uri-list') : this.data.getData('url');

@@ -143,0 +147,0 @@ }

@@ -56,2 +56,6 @@ "use strict";

Deferred.prototype["catch"] = function _catch() {
return Promise.prototype["catch"].apply(this._promise, arguments);
};
Deferred.prototype.then = function then() {

@@ -58,0 +62,0 @@ return Promise.prototype.then.apply(this._promise, arguments);

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

*
*
*/

@@ -25,3 +26,3 @@

*/
function emptyFunction() {}
var emptyFunction = function emptyFunction() {};

@@ -28,0 +29,0 @@ emptyFunction.thatReturns = makeEmptyFunction;

'use strict';
var _assign = require('object-assign');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -170,3 +172,3 @@

return {
keys: function () {
keys: function keys() {
throw TypeError('Strings default iterator doesn\'t implement keys.');

@@ -182,3 +184,3 @@ },

entries: function () {
entries: function entries() {
throw TypeError('Strings default iterator doesn\'t implement entries.');

@@ -246,9 +248,9 @@ }

var GenericIterators = {
keys: function (object) {
keys: function keys(object) {
return new ObjectIterator(object, KIND_KEYS);
},
values: function (object) {
values: function values(object) {
return new ObjectIterator(object, KIND_VALUES);
},
entries: function (object) {
entries: function entries(object) {
return new ObjectIterator(object, KIND_ENTRIES);

@@ -282,3 +284,3 @@ }

Object.assign(enumerate, {
_assign(enumerate, {
/**

@@ -296,9 +298,9 @@ * Export constants

keys: function (object) {
keys: function keys(object) {
return enumerate(object, KIND_KEYS);
},
values: function (object) {
values: function values(object) {
return enumerate(object, KIND_VALUES);
},
entries: function (object) {
entries: function entries(object) {
return enumerate(object, KIND_ENTRIES);

@@ -305,0 +307,0 @@ },

@@ -19,6 +19,6 @@ "use strict";

var ErrorUtils = {
applyWithGuard: function (callback, context, args, onError, name) {
applyWithGuard: function applyWithGuard(callback, context, args, onError, name) {
return callback.apply(context, args);
},
guard: function (callback, name) {
guard: function guard(callback, name) {
return callback;

@@ -25,0 +25,0 @@ }

@@ -36,7 +36,7 @@ 'use strict';

*/
listen: function (target, eventType, callback) {
listen: function listen(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function () {
remove: function remove() {
target.removeEventListener(eventType, callback, false);

@@ -48,3 +48,3 @@ }

return {
remove: function () {
remove: function remove() {
target.detachEvent('on' + eventType, callback);

@@ -64,7 +64,7 @@ }

*/
capture: function (target, eventType, callback) {
capture: function capture(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, true);
return {
remove: function () {
remove: function remove() {
target.removeEventListener(eventType, callback, true);

@@ -83,5 +83,5 @@ }

registerDefault: function () {}
registerDefault: function registerDefault() {}
};
module.exports = EventListener;

@@ -34,3 +34,3 @@ /**

*/
var keyMirror = function (obj) {
var keyMirror = function keyMirror(obj) {
var ret = {};

@@ -37,0 +37,0 @@ var key;

@@ -23,3 +23,3 @@ "use strict";

*/
var keyOf = function (oneKeyObj) {
var keyOf = function keyOf(oneKeyObj) {
var key;

@@ -26,0 +26,0 @@ for (key in oneKeyObj) {

@@ -16,3 +16,3 @@ 'use strict';

var compareNumber = function (a, b) {
var compareNumber = function compareNumber(a, b) {
return a - b;

@@ -19,0 +19,0 @@ };

@@ -9,2 +9,3 @@ /**

*
*
* @typechecks static-only

@@ -17,5 +18,2 @@ */

* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/

@@ -22,0 +20,0 @@

@@ -14,3 +14,3 @@ "use strict";

var compareNumber = function (a, b) {
var compareNumber = function compareNumber(a, b) {
return a - b;

@@ -17,0 +17,0 @@ };

@@ -14,3 +14,3 @@ "use strict";

var nullthrows = function (x) {
var nullthrows = function nullthrows(x) {
if (x != null) {

@@ -17,0 +17,0 @@ return x;

@@ -24,7 +24,7 @@ 'use strict';

if (performance.now) {
performanceNow = function () {
performanceNow = function performanceNow() {
return performance.now();
};
} else {
performanceNow = function () {
performanceNow = function performanceNow() {
return Date.now();

@@ -31,0 +31,0 @@ };

@@ -13,6 +13,6 @@ 'use strict';

var PhotosMimeType = {
isImage: function (mimeString) {
isImage: function isImage(mimeString) {
return getParts(mimeString)[0] === 'image';
},
isJpeg: function (mimeString) {
isJpeg: function isJpeg(mimeString) {
var parts = getParts(mimeString);

@@ -19,0 +19,0 @@ return PhotosMimeType.isImage(mimeString) && (

@@ -40,3 +40,3 @@ "use strict";

*/
getTop: function (element) {
getTop: function getTop(element) {
var doc = element.ownerDocument;

@@ -54,3 +54,3 @@ return _isViewportScrollElement(element, doc) ?

*/
setTop: function (element, newTop) {
setTop: function setTop(element, newTop) {
var doc = element.ownerDocument;

@@ -68,3 +68,3 @@ if (_isViewportScrollElement(element, doc)) {

*/
getLeft: function (element) {
getLeft: function getLeft(element) {
var doc = element.ownerDocument;

@@ -78,3 +78,3 @@ return _isViewportScrollElement(element, doc) ? doc.body.scrollLeft || doc.documentElement.scrollLeft : element.scrollLeft;

*/
setLeft: function (element, newLeft) {
setLeft: function setLeft(element, newLeft) {
var doc = element.ownerDocument;

@@ -81,0 +81,0 @@ if (_isViewportScrollElement(element, doc)) {

@@ -48,3 +48,3 @@ 'use strict';

*/
getScrollParent: function (node) {
getScrollParent: function getScrollParent(node) {
if (!node) {

@@ -51,0 +51,0 @@ return null;

@@ -34,5 +34,5 @@ /**

module.exports = {
getPunctuation: function () {
getPunctuation: function getPunctuation() {
return PUNCTUATION;
}
};

@@ -24,3 +24,3 @@ "use strict";

*/
extractSingleTouch: function (nativeEvent) {
extractSingleTouch: function extractSingleTouch(nativeEvent) {
var touches = nativeEvent.touches;

@@ -27,0 +27,0 @@ var changedTouches = nativeEvent.changedTouches;

@@ -18,2 +18,3 @@ /**

var Immutable = require('immutable');
var UnicodeUtils = require('./UnicodeUtils');

@@ -23,2 +24,18 @@

* @param {number} codePoint Valid Unicode code-point
* @param {number} len Zero-padded minimum width of result
* @return {string} A zero-padded hexadecimal string (00XXXX)
*/
function zeroPaddedHex(codePoint, len) {
var codePointHex = codePoint.toString(16).toUpperCase();
var numZeros = Math.max(0, len - codePointHex.length);
var result = '';
for (var i = 0; i < numZeros; i++) {
result += '0';
}
result += codePointHex;
return result;
}
/**
* @param {number} codePoint Valid Unicode code-point
* @return {string} A formatted Unicode code-point string

@@ -29,4 +46,9 @@ * of the format U+XXXX, U+XXXXX, or U+XXXXXX

codePoint = codePoint || 0; // NaN --> 0
var codePointHex = codePoint.toString(16).toUpperCase();
return 'U+' + '0'.repeat(Math.max(0, 4 - codePointHex.length)) + codePointHex;
var formatted = '';
if (codePoint <= 0xFFFF) {
formatted = zeroPaddedHex(codePoint, 4);
} else {
formatted = codePoint.toString(16).toUpperCase();
}
return 'U+' + formatted;
}

@@ -45,7 +67,161 @@

// We use this funky constructor instead of the object
// constructor because JS object keys are always coerced
// to string, but we want a map of int -> string pairs.
var SpecialEscapesMap = Immutable.Map([[0x07, '\\a'], [0x08, '\\b'], [0x0C, '\\f'], [0x0A, '\\n'], [0x0D, '\\r'], [0x09, '\\t'], [0x0B, '\\v'], [0x22, '\\"'], [0x5c, '\\\\']]);
/**
* Returns a double-quoted PHP string with all non-printable and
* non-US-ASCII sequences escaped.
*
* @param {string} str Valid Unicode string
* @return {string} Double-quoted string with Unicode sequences escaped
*/
function phpEscape(s) {
var result = '"';
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = UnicodeUtils.getCodePoints(s)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var cp = _step.value;
var special = SpecialEscapesMap.get(cp);
if (special !== undefined) {
result += special;
} else if (cp >= 0x20 && cp <= 0x7e) {
result += String.fromCodePoint(cp);
} else if (cp <= 0xFFFF) {
result += '\\u{' + zeroPaddedHex(cp, 4) + '}';
} else {
result += '\\u{' + zeroPaddedHex(cp, 6) + '}';
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator['return']) {
_iterator['return']();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
result += '"';
return result;
}
/**
* Returns a double-quoted Java or JavaScript string with all
* non-printable and non-US-ASCII sequences escaped.
*
* @param {string} str Valid Unicode string
* @return {string} Double-quoted string with Unicode sequences escaped
*/
function jsEscape(s) {
var result = '"';
for (var i = 0; i < s.length; i++) {
var cp = s.charCodeAt(i);
var special = SpecialEscapesMap.get(cp);
if (special !== undefined) {
result += special;
} else if (cp >= 0x20 && cp <= 0x7e) {
result += String.fromCodePoint(cp);
} else {
result += '\\u' + zeroPaddedHex(cp, 4);
}
}
result += '"';
return result;
}
function c11Escape(s) {
var result = '';
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = UnicodeUtils.getCodePoints(s)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var cp = _step2.value;
var special = SpecialEscapesMap.get(cp);
if (special !== undefined) {
result += special;
} else if (cp >= 0x20 && cp <= 0x7e) {
result += String.fromCodePoint(cp);
} else if (cp <= 0xFFFF) {
result += '\\u' + zeroPaddedHex(cp, 4);
} else {
result += '\\U' + zeroPaddedHex(cp, 8);
}
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2['return']) {
_iterator2['return']();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
return result;
}
/**
* Returns a double-quoted C string with all non-printable and
* non-US-ASCII sequences escaped.
*
* @param {string} str Valid Unicode string
* @return {string} Double-quoted string with Unicode sequences escaped
*/
function cEscape(s) {
return 'u8"' + c11Escape(s) + '"';
}
/**
* Returns a double-quoted Objective-C string with all non-printable
* and non-US-ASCII sequences escaped.
*
* @param {string} str Valid Unicode string
* @return {string} Double-quoted string with Unicode sequences escaped
*/
function objcEscape(s) {
return '@"' + c11Escape(s) + '"';
}
/**
* Returns a double-quoted Python string with all non-printable
* and non-US-ASCII sequences escaped.
*
* @param {string} str Valid Unicode string
* @return {string} Double-quoted string with Unicode sequences escaped
*/
function pyEscape(s) {
return 'u"' + c11Escape(s) + '"';
}
var UnicodeUtilsExtra = {
formatCodePoint: formatCodePoint,
getCodePointsFormatted: getCodePointsFormatted
getCodePointsFormatted: getCodePointsFormatted,
zeroPaddedHex: zeroPaddedHex,
phpEscape: phpEscape,
jsEscape: jsEscape,
cEscape: cEscape,
objcEscape: objcEscape,
pyEscape: pyEscape
};
module.exports = UnicodeUtilsExtra;

@@ -115,3 +115,3 @@ /**

isBrowser: function (query) {
isBrowser: function isBrowser(query) {
return compare(UserAgentData.browserName, UserAgentData.browserFullVersion, query);

@@ -129,3 +129,3 @@ },

*/
isBrowserArchitecture: function (query) {
isBrowserArchitecture: function isBrowserArchitecture(query) {
return compare(UserAgentData.browserArchitecture, null, query);

@@ -159,3 +159,3 @@ },

*/
isDevice: function (query) {
isDevice: function isDevice(query) {
return compare(UserAgentData.deviceName, null, query);

@@ -187,3 +187,3 @@ },

*/
isEngine: function (query) {
isEngine: function isEngine(query) {
return compare(UserAgentData.engineName, UserAgentData.engineVersion, query);

@@ -228,3 +228,3 @@ },

*/
isPlatform: function (query) {
isPlatform: function isPlatform(query) {
return compare(UserAgentData.platformName, UserAgentData.platformFullVersion, query, normalizePlatformVersion);

@@ -242,3 +242,3 @@ },

*/
isPlatformArchitecture: function (query) {
isPlatformArchitecture: function isPlatformArchitecture(query) {
return compare(UserAgentData.platformArchitecture, null, query);

@@ -245,0 +245,0 @@ }

@@ -381,3 +381,3 @@ /**

contains: function (range, version) {
contains: function contains(range, version) {
return checkOrExpression(range.trim(), version.trim());

@@ -384,0 +384,0 @@ }

@@ -25,3 +25,3 @@ /**

if (process.env.NODE_ENV !== 'production') {
warning = function (condition, format) {
warning = function warning(condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {

@@ -28,0 +28,0 @@ args[_key - 2] = arguments[_key];

{
"name": "fbjs",
"version": "0.8.2",
"version": "0.8.3",
"description": "A collection of utility libraries used by other Facebook JS projects",

@@ -23,3 +23,3 @@ "main": "index.js",

"fbjs-scripts": "file:scripts",
"flow-bin": "^0.23.0",
"flow-bin": "^0.25.0",
"gulp": "^3.9.1",

@@ -29,3 +29,2 @@ "gulp-babel": "^6.1.2",

"gulp-rename": "^1.2.2",
"immutable": "^3.7.6",
"jest-cli": "^0.9.2",

@@ -67,4 +66,6 @@ "merge-stream": "^1.0.0",

"core-js": "^1.0.0",
"immutable": "^3.7.6",
"isomorphic-fetch": "^2.1.1",
"loose-envify": "^1.0.0",
"object-assign": "^4.1.0",
"promise": "^7.1.1",

@@ -71,0 +72,0 @@ "ua-parser-js": "^0.7.9"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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