Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 2155a7c3641b233f7793b51aaa68cf22c0eee6c6 0 parents
@anthonyshort authored
1  .npmignore
@@ -0,0 +1 @@
+/node_modules/
22 LICENSE-MIT
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Anthony Short
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
57 README.md
@@ -0,0 +1,57 @@
+# ok.js
+
+Simple object validation
+
+## Getting Started
+### On the server
+Install the module with: `npm install ok.js`
+
+```javascript
+var ok_js = require('ok.js');
+ok_js.awesome(); // "awesome"
+```
+
+### In the browser
+Download the [production version][min] or the [development version][max].
+
+[min]: https://raw.github.com/anthonyshort/ok.js/master/dist/ok.js.min.js
+[max]: https://raw.github.com/anthonyshort/ok.js/master/dist/ok.js.js
+
+In your web page:
+
+```html
+<script src="dist/ok.js.min.js"></script>
+<script>
+awesome(); // "awesome"
+</script>
+```
+
+In your code, you can attach ok.js's methods to any object.
+
+```html
+<script>
+this.exports = Bocoup.utils;
+</script>
+<script src="dist/ok.js.min.js"></script>
+<script>
+Bocoup.utils.awesome(); // "awesome"
+</script>
+```
+
+## Documentation
+_(Coming soon)_
+
+## Examples
+_(Coming soon)_
+
+## Contributing
+In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt).
+
+_Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "lib" subdirectory!_
+
+## Release History
+_(Nothing yet)_
+
+## License
+Copyright (c) 2012 Anthony Short
+Licensed under the MIT license.
59 grunt.js
@@ -0,0 +1,59 @@
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ pkg: '<json:package.json>',
+ meta: {
+ banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
+ },
+ concat: {
+ dist: {
+ src: ['<banner:meta.banner>', '<file_strip_banner:lib/<%= pkg.name %>.js>'],
+ dest: 'dist/<%= pkg.name %>.js'
+ }
+ },
+ min: {
+ dist: {
+ src: ['<banner:meta.banner>', '<config:concat.dist.dest>'],
+ dest: 'dist/<%= pkg.name %>.min.js'
+ }
+ },
+ test: {
+ files: ['test/**/*.js']
+ },
+ lint: {
+ files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js']
+ },
+ watch: {
+ files: '<config:lint.files>',
+ tasks: 'lint test'
+ },
+ jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true
+ },
+ globals: {
+ exports: true,
+ module: false
+ }
+ },
+ uglify: {}
+ });
+
+ // Default task.
+ grunt.registerTask('default', 'lint test concat min');
+
+};
15 lib/ok.js.js
@@ -0,0 +1,15 @@
+/*
+ * ok.js
+ * https://github.com/anthonyshort/ok.js
+ *
+ * Copyright (c) 2012 Anthony Short
+ * Licensed under the MIT license.
+ */
+
+(function(exports) {
+
+ exports.awesome = function() {
+ return 'awesome';
+ };
+
+}(typeof exports === 'object' && exports || this));
35 package.json
@@ -0,0 +1,35 @@
+{
+ "name": "ok.js",
+ "description": "Simple object validation",
+ "version": "0.1.0",
+ "homepage": "https://github.com/anthonyshort/ok.js",
+ "author": {
+ "name": "Anthony Short",
+ "email": "antshort@gmail.com",
+ "url": "http://anthonyshort.me"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/anthonyshort/ok.js.git"
+ },
+ "bugs": {
+ "url": "https://github.com/anthonyshort/ok.js/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/anthonyshort/ok.js/blob/master/LICENSE-MIT"
+ }
+ ],
+ "main": "lib/ok.js",
+ "engines": {
+ "node": "*"
+ },
+ "scripts": {
+ "test": "grunt test"
+ },
+ "devDependencies": {
+ "grunt": "~0.3.15"
+ },
+ "keywords": []
+}
35 test/ok.js_test.js
@@ -0,0 +1,35 @@
+/*global require:true */
+var ok_js = require('../lib/ok.js.js');
+
+/*
+ ======== A Handy Little Nodeunit Reference ========
+ https://github.com/caolan/nodeunit
+
+ Test methods:
+ test.expect(numAssertions)
+ test.done()
+ Test assertions:
+ test.ok(value, [message])
+ test.equal(actual, expected, [message])
+ test.notEqual(actual, expected, [message])
+ test.deepEqual(actual, expected, [message])
+ test.notDeepEqual(actual, expected, [message])
+ test.strictEqual(actual, expected, [message])
+ test.notStrictEqual(actual, expected, [message])
+ test.throws(block, [error], [message])
+ test.doesNotThrow(block, [error], [message])
+ test.ifError(value)
+*/
+
+exports['awesome'] = {
+ setUp: function(done) {
+ // setup here
+ done();
+ },
+ 'no args': function(test) {
+ test.expect(1);
+ // tests here
+ test.equal(ok_js.awesome(), 'awesome', 'should be awesome.');
+ test.done();
+ }
+};
Please sign in to comment.
Something went wrong with that request. Please try again.