This repository was archived by the owner on Dec 9, 2022. It is now read-only.
forked from Marak/javascript-fu
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstring.js
More file actions
64 lines (52 loc) · 1.29 KB
/
string.js
File metadata and controls
64 lines (52 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var vows = require('../vows/lib/vows'),
assert = require('assert');
var sys = require('sys');
var format = require('../index');
function isNumber( n ){
// sys.puts('isNumber ' + n)
if(n.toString() == 'NaN'){
return [false, 'NaN, nananana!'];
}
if(n instanceof Number){
return [true, 'WIN!'];
}
else{
return [false, n.toString() + ' is not a number.'];
}
}
// exports.toString(); <= LOL we don't need this right?
/*
getNumbers
stripLetters
getLetters
*/
/*
vows.describe('format.js lib/string').addVows({
"stripNumbers()": {
"on string with randomly placed numbers": {
topic: 'kjas(^12p/)^&34mm6',
"can remove all the numbers":function( s ){
var result = format.string.stripNumbers( s );
if( !format.types.isNumber( s ) ){
assert.ok( true );
}
else{
assert.ok( false, '"' + s + '"' + ' still has numbers in it ');
}
}}
},
"getNumbers()": {
"on string with randomly placed numbers": {
topic: 'kjas(^12p/)^&34mm6',
"can get all the numbers":function( s ){
var result = format.string.getNumbers( s );
if( !format.types.isNumber( s ) ){
assert.ok( true );
}
else{
assert.ok( false, '"' + s + '"' + ' still has numbers in it ');
}
}}
}
});
*/