coffee_enhancer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +93 -2
- data/lib/assets/javascripts/datetime.coffee +1 -1
- data/lib/assets/javascripts/string.coffee +5 -4
- data/lib/coffee_enhancer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c272747e8b989e54a7e35e24a725dcd9e6a8dc
|
4
|
+
data.tar.gz: 1d3c82b89db67bbf711f5df930c78e59d0818f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10dea5fae5b7028412a22df5bca5ca53f94adadc5703c26a6bd6f49a48437281267f3ed2fb30f3daafe897b03e8e304b06fc296bc3c341abd699206ef45eac27
|
7
|
+
data.tar.gz: 778c72ccff1e79b5b2348d7d789dfdec329ac8372e4c594ed27026f079c840caebad5dcc59f3481ae8206f4ad0066c11cfcbb07fb7f7516f46c4f2c5dc4410d0
|
data/README.md
CHANGED
@@ -21,11 +21,102 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
|
24
|
+
Add this to your application.js file:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
//= coffee_enhancer
|
28
|
+
```
|
29
|
+
|
30
|
+
## Documentation
|
31
|
+
|
32
|
+
**Adds the following methods for coffee/js :**
|
33
|
+
|
34
|
+
```coffescript
|
35
|
+
|
36
|
+
# Checks if array or string element is present
|
37
|
+
Array::present()
|
38
|
+
|
39
|
+
# Checks if array element is empty
|
40
|
+
Array::empty()
|
41
|
+
|
42
|
+
# Checks if array element is empty
|
43
|
+
Array::any()
|
44
|
+
|
45
|
+
# Formats time to 12 hour clock time
|
46
|
+
Date::formatted_time_with_pm()
|
47
|
+
|
48
|
+
# Formats time to 24 hour clock time
|
49
|
+
Date::formatted_time()
|
50
|
+
|
51
|
+
# Formats date
|
52
|
+
Date::formatted_date()
|
53
|
+
|
54
|
+
# Gives an english string describing the time since datetime stamp
|
55
|
+
Date::time_ago_in_words()
|
56
|
+
|
57
|
+
# Method that checks if a certain variable is undefined or null
|
58
|
+
non_existent(variable)
|
59
|
+
|
60
|
+
# Method that checks if a certain variable is defined and not null
|
61
|
+
exists(variable)
|
62
|
+
|
63
|
+
# Method that checks if a certain variable is defined
|
64
|
+
defined(variable)
|
65
|
+
|
66
|
+
# Method that checks if a certain variable is undefined
|
67
|
+
not_defined(variable)
|
68
|
+
|
69
|
+
# Method that checks if a certain variable is loaded (used in ReactJs mostly)
|
70
|
+
loaded(variable)
|
71
|
+
|
72
|
+
# Checks if number is positive or equal to zero
|
73
|
+
Number::is_positive()
|
74
|
+
|
75
|
+
# Checks if number is equal to zero
|
76
|
+
Number::is_zero()
|
77
|
+
|
78
|
+
# Checks if number is smaller or equal to zero
|
79
|
+
Number::is_negative()
|
80
|
+
|
81
|
+
# Converts to currency
|
82
|
+
Number::to_currency()
|
83
|
+
|
84
|
+
# Converts to string
|
85
|
+
Number::to_s()
|
86
|
+
|
87
|
+
# Converts to integer
|
88
|
+
Number::to_i()
|
89
|
+
|
90
|
+
# Checks if string element is blank
|
91
|
+
String::blank()
|
92
|
+
|
93
|
+
# Checks if string element is empty
|
94
|
+
String::empty()
|
95
|
+
|
96
|
+
# Checks if string element is present
|
97
|
+
String::present()
|
98
|
+
|
99
|
+
# Converts string to integer
|
100
|
+
String::to_i()
|
101
|
+
parseInt(@)
|
102
|
+
|
103
|
+
# Converts string to float
|
104
|
+
String::to_f()
|
105
|
+
|
106
|
+
# Converts the first character of string to uppercase and the rest to downcase
|
107
|
+
String::capitalize()
|
108
|
+
|
109
|
+
# Removes whitespaces before and after the content of the string
|
110
|
+
String::trim()
|
111
|
+
|
112
|
+
# Converts the first character of each word to uppercase and the rest to downcase
|
113
|
+
String::titleize()
|
114
|
+
|
115
|
+
```
|
25
116
|
|
26
117
|
## Development
|
27
118
|
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
119
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake jasmine:ci` to run the tests.
|
29
120
|
|
30
121
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
122
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
## Checks if string element is blank
|
1
|
+
## Checks if string element is blank, empty or present
|
2
2
|
String::blank = ->
|
3
3
|
not @.replace(/^\s+|\s+|\n+$/g, '')?.length
|
4
4
|
|
@@ -16,14 +16,15 @@ String::to_i = ->
|
|
16
16
|
String::to_f = ->
|
17
17
|
parseFloat(@)
|
18
18
|
|
19
|
-
## Converts the first character of string to uppercase
|
19
|
+
## Converts the first character of string to uppercase and the rest to lowercase
|
20
20
|
String::capitalize = ->
|
21
|
-
"#{@.charAt(0).toUpperCase()}#{@.substr(1)}"
|
21
|
+
"#{@.charAt(0).toUpperCase()}#{@.substr(1).toLowerCase()}"
|
22
22
|
|
23
|
+
## Removes the whitespace before and after the content of the string
|
23
24
|
String::trim = ->
|
24
25
|
@.replace /^\s+|\s+$/g, ''
|
25
26
|
|
26
|
-
## Converts the first character of each word to uppercase
|
27
|
+
## Converts the first character of each word to uppercase and the rest to lowercase
|
27
28
|
String::titleize = ->
|
28
29
|
title = ''
|
29
30
|
for word in @.toLowerCase().split(' ')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee_enhancer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Fugere
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|