Giter Site home page Giter Site logo

extend-native-js's Introduction

Beware!

Modifying the native JavaScript objects leads to unexpected behaviour.

We use this within a sandboxed environment. Don't use this for your website.

String methods

string capitalize()

Turn the first character of a string into uppercase.

string camelCase()

Turn a sentense into CamelCase.

float toInt()

Turn the string into an integer using parseInt.

float toFloat()

Turn the string into an float using parseFloat.

Date toDate()

Turn the string into a Date object with 'date' format, using moment.js.

Date toDateTime()

Turn the string into a Date object with 'date time' format, using moment.js.

Date toTime()

Turn the string into a Date object with 'time' format, using moment.js.

string dateFormat(string formatAs)

Turn the string into a Date object, than format that date.

Date addPeriod(int duration, string unit) or Date addPeriod(object period)

Turn the string into a Date object, than add a period.

Date substractPeriod(int duration, string unit) or Date substractPeriod(object period)

Turn the string into a Date object, than substract a period.

string asList(string listType)

Split the string on a line break, than turn the lines into an unordered (<ul>) or ordered (<ol>) list.

Array methods

string asList(string listType)

Create an unordered (<ul>) or ordered (<ol>) list with each item in the array.

string toString()

Join the items of array with a komma.

boolean includes(item)

Minimal polyfill of Array.includes.

Array functions

boolean isArray

Polyfill of Array.isArray.

Number methods

spelledOut()

Spell out the numbers using the spell-it library.

window.spell = spellit('fr');

var number = 42;
console.log(number.spelledOut());
// fourty two

extend-native-js's People

Contributors

jasny avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

extend-native-js's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.