1.1.7 • Published 5 years ago

javascript-helper-functions v1.1.7

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

javascript-helper-functions

🐠 A list of helpful javascript functions!

NPM JavaScript Style Guide

Install

npm install --save javascript-helper-functions

Usage

import React, { Component } from "react";
import { truncateText } from "javascript-helper-functions";

class Example extends Component {
  render() {
    const bodyText =
      "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting.";

    return <div>{truncateText(bodyText, 20)}</div>;
    // This will return "Lorem Ipsum is simpl..."
  }
}

export default Example;

String Helpers

FunctionDescriptionExampleArgs
truncateTextReturns truncated text ending with "..."truncateText(string, 20)1. string 2. length
toTitleCaseReturns string in title casetoTitleCase(string)1. string

Number Helpers

FunctionDescriptionExampleArgs
intCommaReturns number in comma seperated numberintComma(number)1. number
isEvenReturns if number is even or notisEven(number)1. number

Array Helpers

Object Helpers

FunctionDescriptionExampleArgs
copyObjectReturns a copy of the objectcopyObject(obj)1. object

URL Helpers

FunctionDescriptionExampleArgs
addParamAdds parameter to url, EG: www.google.com/?page=1addParam('page', 1)1. option, 2. option
updateParamUpdates parameter to url, EG: www.google.com/?page=1 => ?page=2addParam('page', 2)1. option, 2. option

License

MIT © dane-brown

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago