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

@react-native-firebase/common

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-firebase/common - npm Package Compare versions

Comparing version 0.0.4 to 0.0.26

lib/Base64.js

79

lib/index.js

@@ -17,17 +17,78 @@ /*

*/
import { Platform } from 'react-native';
import { isString } from './validate';
import Base64 from './Base64';
export * from './id';
export * from './path';
export * from './validate';
export * from './promise';
export Base64 from './Base64';
export ReferenceBase from './ReferenceBase';
export function promiseDefer() {
const deferred = {
resolve: null,
reject: null,
export function getDataUrlParts(dataUrlString) {
const isBase64 = dataUrlString.includes(`;base64`);
let [mediaType, base64String] = dataUrlString.split(',');
if (!mediaType || !base64String) return { base64String: undefined, mediaType: undefined };
mediaType = mediaType.replace('data:', '').replace(';base64', '');
if (base64String && base64String.includes('%')) base64String = decodeURIComponent(base64String);
if (!isBase64) base64String = Base64.btoa(base64String);
return { base64String, mediaType };
}
export function once(fn, context) {
let onceResult;
let ranOnce = false;
return function onceInner(...args) {
if (!ranOnce) {
ranOnce = true;
onceResult = fn.apply(context || this, args);
}
return onceResult;
};
}
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
export function isError(value) {
if (Object.prototype.toString.call(value) === '[object Error]') {
return true;
}
return deferred;
return value instanceof Error;
}
export function hasOwnProperty(target, property) {
return Object.hasOwnProperty.call(target, property);
}
/**
* Remove a trailing forward slash from a string if it exists
*
* @param string
* @returns {*}
*/
export function stripTrailingSlash(string) {
if (!isString(string)) return string;
return string.endsWith('/') ? string.slice(0, -1) : string;
}
export const isIOS = Platform.OS === 'ios';
export const isAndroid = Platform.OS === 'android';
export function tryJSONParse(string) {
try {
return string && JSON.parse(string);
} catch (jsonError) {
return string;
}
}
export function tryJSONStringify(data) {
try {
return JSON.stringify(data);
} catch (jsonError) {
return null;
}
}

@@ -20,2 +20,15 @@ /*

export function objectKeyValuesAreStrings(object) {
if (!isObject(object)) return false;
const entries = Object.entries(object);
for (let i = 0; i < entries.length; i++) {
const [key, value] = entries[i];
if (!isString(key) || !isString(value)) return false;
}
return true;
}
/**

@@ -61,2 +74,11 @@ * Simple is null check.

/**
* Simple is number check
* @param value
* @return {boolean}
*/
export function isNumber(value) {
return typeof value === 'number';
}
/**
* Simple is boolean check

@@ -63,0 +85,0 @@ *

4

package.json
{
"name": "@react-native-firebase/common",
"version": "0.0.4",
"version": "0.0.26",
"author": "Invertase <oss@invertase.io> (http://invertase.io)",

@@ -18,3 +18,3 @@ "description": "React Native Firebase internal common utilities & helpers.",

],
"gitHead": "2787d4413eb70c61a687c4d6913add6a6a01f582",
"gitHead": "639c15d4b8ba8a972f0fe17fcc285b4a6e4af320",
"publishConfig": {

@@ -21,0 +21,0 @@ "access": "public"

@@ -5,3 +5,3 @@ <p align="center">

</a>
<h4 align="center">React Native Firebase - Common</h2>
<h2 align="center">React Native Firebase - Common</h2>
</p>

@@ -13,12 +13,14 @@

<a href="/LICENSE"><img src="https://img.shields.io/npm/l/react-native-firebase.svg?style=flat-square" alt="License"></a>
<a href="#backers"><img src="https://opencollective.com/react-native-firebase/backers/badge.svg?style=flat-square" alt="Backers on Open Collective"></a>
<a href="#sponsors"><img src="https://opencollective.com/react-native-firebase/sponsors/badge.svg?style=flat-square" alt="Sponsors on Open Collective"></a>
<a href="https://discord.gg/C9aK28N"><img src="https://img.shields.io/discord/295953187817521152.svg?logo=discord&style=flat-square&colorA=7289da&label=discord" alt="Chat"></a>
<a href="https://twitter.com/rnfirebase"><img src="https://img.shields.io/twitter/follow/rnfirebase.svg?style=social&label=Follow" alt="Follow on Twitter"></a>
<a href="https://lerna.js.org/"><img src="https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg?style=flat-square" alt="Maintained with Lerna"></a>
</p>
----
<p align="center">
<a href="https://invertase.link/discord"><img src="https://img.shields.io/discord/295953187817521152.svg?style=flat-square&colorA=7289da&label=Chat%20on%20Discord" alt="Chat on Discord"></a>
<a href="https://twitter.com/rnfirebase"><img src="https://img.shields.io/twitter/follow/rnfirebase.svg?style=flat-square&colorA=1da1f2&colorB=&label=Follow%20on%20Twitter" alt="Follow on Twitter"></a>
</p>
> This is for the upcoming v6.0.0 release of React Native Firebase, please use the [react-native-firebase](https://www.npmjs.com/package/react-native-firebase) package instead, unless you're early adopting/testing the new packages - in which case please use the latest alpha/beta/next tag release on npm and not the `latest` tagged release for this package.
---
> This is for the upcoming v6.0.0 release of React Native Firebase, please use the [react-native-firebase](https://www.npmjs.com/package/react-native-firebase) package instead, unless you're early adopting/testing the new packages - in which case please use the `latest` tagged patch-only release for this package.
This is not the package you're looking for.

@@ -30,8 +32,16 @@

----
---
Built and maintained with 💛 by [Invertase](https://invertase.io).
<p>
<img align="left" width="75px" src="https://static.invertase.io/assets/invertase-logo-small.png">
<p align="left">
Built and maintained with 💛 by <a href="https://invertase.io">Invertase</a>.
</p>
<p align="left">
<a href="https://invertase.io/hire-us">💼 Hire Us</a> |
<a href="https://opencollective.com/react-native-firebase">☕️ Sponsor Us</a> |
<a href="https://opencollective.com/jobs">‍💻 Work With Us</a>
</p>
</p>
- [💼 Hire Us](https://invertase.io/hire-us)
- [☕️ Sponsor Us](https://opencollective.com/react-native-firebase)
- [👩‍💻 Work With Us](https://invertase.io/jobs)
---
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