Skip to content

Latest commit

 

History

History
98 lines (67 loc) · 1.74 KB

README.md

File metadata and controls

98 lines (67 loc) · 1.74 KB

AUTOMAIL JS Build Status

Automail JS is a prototype extension for js lang

Installation

  • Bower bower install -S automail

Table of extended Functions

  1. Array
  2. String

Array

  • contains
console.log([1,2,3].contains(2)); // => true
console.log([1,2,3].contains(9)); // => false
  • first
console.log([1,2,3].first()); // => 1
console.log([].first()); // => null
  • last
console.log([1,2,3].last()); // => 3
console.log([].last()); // => null
  • size
console.log([1,2,3].size()); // => 3
console.log([].size()); // => 0
  • isEmpty
console.log([1,2,3].isEmpty()); // => false
console.log([].isEmpty()); // => true
  • removeAt
var array = [1,2,3];
console.log(array.removeAt(1)); // => 2
console.log(array); // => [1,3]
  • remove
var array = [1,2,3];
console.log(array.remove(2)); // => 2
console.log(array); // => [1,3]

⬆ back to top

String

  • contains
console.log('automail'.contains('mail')); // => true
console.log('autoMail'.contains('mail')); // => false

// case insensitive
console.log('autoMail'.contains('mail', true)); // => true
  • capitalize
console.log('automail'.capitalize()); // => 'Automail'
  • startsWith
console.log('automail'.startsWith('auto')); // => true
console.log('AutoMail'.startsWith('auto')); // => false

// case insensitive
console.log('AutoMail'.startsWith('auto', true)); // => true

⬆ back to top