jextend 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dd35310c27ca4ff6232164ae64480508b7aa6d0
4
- data.tar.gz: 0efa8b8768235bc2894e7714c9f2bff1f44fd653
3
+ metadata.gz: a93324b3e5f1dedf5c78f1a1620244768e75d70c
4
+ data.tar.gz: c63d128d90d2f86218079ff2878f38ed6223ad0d
5
5
  SHA512:
6
- metadata.gz: b16560b4991cbe64edcfc63dd7feccfecfa435bbd59f9df291b52d2c9c0dc22e1904d104f74e4d3e1a0fcac576db31143aae828c37efd15e880b8863c1683b79
7
- data.tar.gz: a2066936beff1b661301102d831b64fa43a87f6f1af3428a1133ab735a453c16b8294b44b6f63861fad18eefaeb22340d2a5bf8ad8d35accd29025eb3463aa8d
6
+ metadata.gz: 88df0309d3a927a3372e29fccc70ae99a3da8f966177c4cd11125f3e6d7633ccce1563c5f8c8120f6410361575f8de3e4005aacf07ee13092ebaa81dc99810e6
7
+ data.tar.gz: 00ffb2816643cde1511832619a6937ecbc59919c6e59dc611eb11bea0eb379c7d8d58f004f658640d882ed48cb97dd48a9a730e99de23bb492e8530cddede13c
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Jextend
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jextend`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ 常用的一些javascript函数总结
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+
6
+ ## Status
7
+ 代码 已经打包发布到 RubyGems.
8
+
9
+ [![image](https://ruby-china-files.b0.upaiyun.com/photo/5982eaaa64f467d9dbda03ad4f40ea27.png)](https://rubygems.org/gems/jextend)
6
10
 
7
11
  ## Installation
8
12
 
@@ -20,15 +24,54 @@ Or install it yourself as:
20
24
 
21
25
  $ gem install jextend
22
26
 
27
+ Write this in your `application.js`
28
+ ```javascript
29
+ //=require jextend
30
+ ```
31
+
23
32
  ## Usage
33
+ ### Array
24
34
 
25
- TODO: Write usage instructions here
35
+ ```javascript
36
+ [2,3,5].contains(3);
37
+ //=>true
38
+ [2,3,5].contains(6);
39
+ //=>false
40
+ ```
41
+ ### Date
26
42
 
27
- ## Development
43
+ ```javascript
44
+ new Date().format('yyyy-MM-dd');
45
+ //=>"2016-04-20"
46
+ ```
47
+ ### Math
48
+ ```javascript
49
+ Math.n_pow(2,3);
50
+ //=>8_
51
+ Math.decimal_point('3.3333',2);
52
+ //=>3.33_
53
+ ```
54
+ ### String
28
55
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
56
+ ```javascript
57
+ "Good {0} everyone.How do {1} do?".format('morning','you');
58
+ //=> "Good morning everyone.How do you do?"
59
+
60
+ String.random(32);
61
+ //=>"t7m5dzu3zn2jxb34qykjkrifjeo77rj1"
62
+
63
+ String.random(10,true);
64
+ //=>"f0jz19hgER"
65
+
66
+ ```
67
+
68
+ ### window.location.params
69
+ ```javascript
70
+ //current_url: http://localhost:3000/?start_date=2015-12-06&type=newer_
71
+ window.location.params()
72
+ //=>{start_date:'2015-12-06',type:'newer'}
73
+ ```
30
74
 
31
- 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
75
 
33
76
  ## Contributing
34
77
 
@@ -1,3 +1,3 @@
1
1
  module Jextend
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -20,3 +20,19 @@ String.prototype.format = function (args) {
20
20
  }
21
21
  return result;
22
22
  };
23
+
24
+ /**
25
+ * 生成随机字符串
26
+ * @param len 字符串长度
27
+ * @param includeUpcase 是否包含大写字符,默认为false
28
+ * @returns {string}
29
+ */
30
+ String.random = function (len, includeUpcase) {
31
+ var str = '0123456789abcdefghijklmnopqrstuvwxyz';
32
+ var randomStr = '';
33
+ for (var i = 0; i < len; i++) {
34
+ var c = String(str[parseInt(Math.random() * str.length)]);
35
+ randomStr += (includeUpcase && parseInt(Math.random() * 10) % 2 == 0) ? c.toUpperCase() : c;
36
+ }
37
+ return randomStr;
38
+ };
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jextend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler