1.0.6 • Published 7 months ago

react-native-helper-functions v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

React Native Helpers

This is a collection of helper functions for React Native applications.

Installation

To install this package using npm, open your terminal or command prompt and run the following command:

npm install react-native-helpers
yarn add react-native-helpers

Usage

Example usage of the helper functions:

Filtering Arrays

Filters an array based on a provided predicate function and returns a new array containing the filtered elements.

import {filterArray } from 'react-native-helpers';

const numbers = [1, 2, 3, 4, 5];

// Filter even numbers
const evenNumbers = filterArray(numbers, (num) => num % 2 === 0);

console.log(evenNumbers); // Should print [2, 4]

Shuffling Arrays

Shuffles the elements of an array randomly and returns a new shuffled array.

import { shuffleArray } from 'react-native-helpers';

// Shuffle the array
const shuffledArray = shuffleArray(numbers);

console.log(shuffledArray); // Should print an array with elements in random order

Formatting Time

Formats a time in a human-readable format and returns the formatted time string.

import { formatTime } from 'react-native-helpers';

const currentTime = new Date();

// Format the time
const formattedTime = formatTime(currentTime);

console.log(formattedTime); // Should print the current time in a human-readable format

Formatting Dates

Formats a date in a human-readable format and returns the formatted date string.

import { formatDate } from 'react-native-helpers';

const currentDate = new Date();

// Format the date
const formattedDate = formatDate(currentDate);

console.log(formattedDate); // Should print the current date in a human-readable format

Capitalizing Text

Capitalizes the first letter of a given text and returns the capitalized text.

import { capitalize } from 'react-native-helpers';

const originalText = 'hello';

// Capitalize the text
const capitalizedText = capitalize(originalText);

console.log(capitalizedText); // Should print "Hello"
1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago