wrangler 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. package/README.md +40 -33
  2. package/package.json +1 -1
  3. package/.npmignore +0 -15
package/README.md CHANGED
@@ -1,4 +1,11 @@
1
+ # WARNING
2
+
3
+ - If you're looking for Cloudflare's CLI to use and develope Cloudflare Workers, please run `npm install @cloudflare/wrangler`.
4
+
5
+ - If you're looking for the experimental beta release for the CLI for Cloudflare Workers, please run `npm install wrangler@beta`.
6
+
1
7
  # Wrangler
8
+
2
9
  `Wrangler` is a very small CommonJS module that smoothes over some of the gotchas in JavaScript type checking and casting. It behaves the way you (or rather, I) would expect type checking and casting to work -- e.g., `is.object()` only works on objects that are neither arrays nor regular expressions. It also makes `indexOf()` easier to use, and provides search functions. Works in Node; should work in browser as well, exporting the objects `is` and `to` into the global namespace.
3
10
 
4
11
  None of these techniques are earth-shattering; most people will use these in their daily work. I just didn't want to have to remember all of them while I was banging out code.
@@ -11,42 +18,42 @@ Test coverage is as thorough as my imagination allows. I used Jasmine for unit t
11
18
 
12
19
  All checking is strict, unless otherwise noted. Each function returns either true or false.
13
20
 
14
- * `is.undefined( value )`
15
- * `is.null( value )`
16
- * `is.empty( value )` - checks for null or undefined
17
- * `is.empty.array( value )` or `is.emptyArray( value )` - must be an array-like object and have no items
18
- * `is.empty.arguments( value )` or `is.emptyArguments( value )` - identical to above
19
- * `is.empty.object( value )` or `is.emptyObject( value )` - must be an object and have no properties of its own; objects with properties in their prototype chains will also fail
20
- * `is.null( value )`
21
- * `is.boolean( value )`
22
- * `is.nan( value )` - really not necessary, since it merely calls `isNan()`. But I just included it to be thorough.
23
- * `is.infinite( value )` - opposite of `isFinite()`. I didn't include an `isFinite()` function because `is.number()` performs this check.
24
- * `is.number( value )` - includes all the sensible numbers (e.g., not `NaN` or `Infinity`).
25
- * `is.integer( value )` - we all know JavaScript doesn't have integers or floats, so this fills half that gap.
26
- * `is.float( value )` - and this fills the other half of the gap.
27
- * `is.string( value )`
28
- * `is.object( value )` - anything considered to be an object, except `null`, regular expressions, arrays, or array-like objects. Functions are considered objects, of course.
29
- * `is.array( value )` - any good old honest 'true' array.
30
- * `is.enumerable( value )` - arrays, array-like objects, and strings. Anything that can be iterated upon. (Yes, that does include strings!)
31
- * `is.arrayLike( value )` - array-like objects (but not arrays).
32
- * `is.arguments( value )` - the `arguments` array-like object.
33
- * `is.function( value )`
34
- * `is.regexp( value )`
35
- * `is.in( needle [, haystack] )` - takes a needle and performs a strict search on the haystack. If the haystack is not supplied, `this` is assumed as the haystack. The haystack can be an object, array-like object, or string. In case of objects, only the self-owned, direct descendants are searched.
36
- * `is.in.array( needle [, haystack] )` or `is.inArray( needle [, haystack] )` - works on array-like objects only.
37
- * `is.in.object( needle [, haystack] )` or `is.inObject( needle [, haystack] )` - works only on haystacks that pass the `is.object()` test.
38
- * `is.in.string( needle [, haystack] )` or `is.inString( needle [, haystack] )` - string search; converts non-strings to strings.
39
- * `is.ownProperty( property [, object] )` - calls `Object.prototype.hasOwnProperty()` on the object. If the object is not supplied, `this` is assumed.
21
+ - `is.undefined( value )`
22
+ - `is.null( value )`
23
+ - `is.empty( value )` - checks for null or undefined
24
+ - `is.empty.array( value )` or `is.emptyArray( value )` - must be an array-like object and have no items
25
+ - `is.empty.arguments( value )` or `is.emptyArguments( value )` - identical to above
26
+ - `is.empty.object( value )` or `is.emptyObject( value )` - must be an object and have no properties of its own; objects with properties in their prototype chains will also fail
27
+ - `is.null( value )`
28
+ - `is.boolean( value )`
29
+ - `is.nan( value )` - really not necessary, since it merely calls `isNan()`. But I just included it to be thorough.
30
+ - `is.infinite( value )` - opposite of `isFinite()`. I didn't include an `isFinite()` function because `is.number()` performs this check.
31
+ - `is.number( value )` - includes all the sensible numbers (e.g., not `NaN` or `Infinity`).
32
+ - `is.integer( value )` - we all know JavaScript doesn't have integers or floats, so this fills half that gap.
33
+ - `is.float( value )` - and this fills the other half of the gap.
34
+ - `is.string( value )`
35
+ - `is.object( value )` - anything considered to be an object, except `null`, regular expressions, arrays, or array-like objects. Functions are considered objects, of course.
36
+ - `is.array( value )` - any good old honest 'true' array.
37
+ - `is.enumerable( value )` - arrays, array-like objects, and strings. Anything that can be iterated upon. (Yes, that does include strings!)
38
+ - `is.arrayLike( value )` - array-like objects (but not arrays).
39
+ - `is.arguments( value )` - the `arguments` array-like object.
40
+ - `is.function( value )`
41
+ - `is.regexp( value )`
42
+ - `is.in( needle [, haystack] )` - takes a needle and performs a strict search on the haystack. If the haystack is not supplied, `this` is assumed as the haystack. The haystack can be an object, array-like object, or string. In case of objects, only the self-owned, direct descendants are searched.
43
+ - `is.in.array( needle [, haystack] )` or `is.inArray( needle [, haystack] )` - works on array-like objects only.
44
+ - `is.in.object( needle [, haystack] )` or `is.inObject( needle [, haystack] )` - works only on haystacks that pass the `is.object()` test.
45
+ - `is.in.string( needle [, haystack] )` or `is.inString( needle [, haystack] )` - string search; converts non-strings to strings.
46
+ - `is.ownProperty( property [, object] )` - calls `Object.prototype.hasOwnProperty()` on the object. If the object is not supplied, `this` is assumed.
40
47
 
41
48
  ### Type casting
42
49
 
43
- * `to.boolean( value )`
44
- * `to.number( value )` or `to.float( value )` - calls `parseFloat()` on the value; therefore, it may return `NaN`.
45
- * `to.integer( value )` - returns the integral part of the value. Acts as floor for positive numbers and ceiling for negative integers.
46
- * `to.string( value )`
47
- * `to.array( value )` - casts array-like objects to arrays and everything else to an array containing a single element, which happens to be the passed value.
48
- * `to.regexp( value )` - if the value is a string, returns a regular expression using the `new RegExp()` constructor. Returns `undefined` if the value is not a string.
49
- * `to.date( value )` - returns a new date object using the `new Date()` constructor.
50
+ - `to.boolean( value )`
51
+ - `to.number( value )` or `to.float( value )` - calls `parseFloat()` on the value; therefore, it may return `NaN`.
52
+ - `to.integer( value )` - returns the integral part of the value. Acts as floor for positive numbers and ceiling for negative integers.
53
+ - `to.string( value )`
54
+ - `to.array( value )` - casts array-like objects to arrays and everything else to an array containing a single element, which happens to be the passed value.
55
+ - `to.regexp( value )` - if the value is a string, returns a regular expression using the `new RegExp()` constructor. Returns `undefined` if the value is not a string.
56
+ - `to.date( value )` - returns a new date object using the `new Date()` constructor.
50
57
 
51
58
  More typecasting to follow, as I think of cases that need it!
52
59
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Paul d'Aoust <paul@heliosstudio.ca> (http://heliosstudio.ca/)",
3
3
  "name": "wrangler",
4
4
  "description": "'Wrangler' is a very small module that smoothes over some of the gotchas in JavaScript type checking and casting. It behaves the way you (or perhaps just I) would expect type checking to work -- e.g., is.object() only works on objects that are neither arrays nor regular expressions. It also makes indexOf() easier to use, and provides search functions. Works in Node; should work in browser as well, exporting a variable 'is' into the global namespace.",
5
- "version": "0.0.2",
5
+ "version": "0.0.3",
6
6
  "main": "index.js",
7
7
  "scripts": {
8
8
  "test": "jasmine-node tests/*.spec.js"
package/.npmignore DELETED
@@ -1,15 +0,0 @@
1
- lib-cov
2
- *.seed
3
- *.log
4
- *.csv
5
- *.dat
6
- *.out
7
- *.pid
8
- *.gz
9
-
10
- pids
11
- logs
12
- results
13
-
14
- node_modules
15
- npm-debug.log