diff --git a/.jscsrc b/.jscsrc index 18273c0..51130aa 100644 --- a/.jscsrc +++ b/.jscsrc @@ -8,6 +8,7 @@ "disallowYodaConditions": true, "requireBlocksOnNewline": 1, "requireCamelCaseOrUpperCaseIdentifiers": true, + "requireVarDeclFirst": null, "requireMultipleVarDecl": true, "validateIndentation": "\t", "validateLineBreaks": "LF", diff --git a/.jshintrc b/.jshintrc index f8553bc..87162c0 100644 --- a/.jshintrc +++ b/.jshintrc @@ -13,6 +13,8 @@ "browser": true, "globals": { - "jQuery": false + "jQuery": false, + "define": false, + "require": false } } diff --git a/Gruntfile.js b/Gruntfile.js index 453549f..b9b25e0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,7 +4,6 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-jscs'); grunt.initConfig({ @@ -45,18 +44,10 @@ module.exports = function (grunt) { banner: '/*! jQuery JSON plugin v<%= pkg.version %> | github.com/Krinkle/jquery-json */\n' } } - }, - watch: { - files: [ - '.{jscsrc,jshintignore,jshintrc}', - '<%= jshint.all %>' - ], - tasks: 'test' } }); grunt.registerTask('lint', ['jshint', 'jscs']); grunt.registerTask('build', ['lint', 'uglify']); grunt.registerTask('test', ['build', 'connect', 'qunit']); - grunt.registerTask('default', 'test'); }; diff --git a/HISTORY.md b/HISTORY.md index 58598d1..75b1b5b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 2.6.0 / 2016-08-19 + +* (#57) Added support for AMD and CommonJS loading. + ## 2.5.0 / 2014-07-11 * (#66) build: Switch to UglifyJS for better minification (2.3kb -> 1.9kb). diff --git a/LICENSE.txt b/LICENSE.txt index 5232007..fb803a1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ Copyright 2009-2011 Brantley Harris -Copyright 2010–2014 Timo Tijhof +Copyright 2010–2016 Timo Tijhof Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.md b/README.md index 1dc4321..6a4686a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Build Status](https://travis-ci.org/Krinkle/jquery-json.svg?branch=master)](https://travis-ci.org/Krinkle/jquery-json) [![npm](https://img.shields.io/npm/v/jquery-json.svg?style=flat)](https://www.npmjs.com/package/jquery-json) +[![npm](https://img.shields.io/npm/v/jquery-json.svg?style=flat)](https://www.npmjs.com/package/jquery-json) +[![Tested with QUnit](https://img.shields.io/badge/tested_with-qunit-9c3493.svg)](https://qunitjs.com/) # jQuery JSON diff --git a/dist/jquery.json.min.js b/dist/jquery.json.min.js index 44e246f..8dcca65 100644 --- a/dist/jquery.json.min.js +++ b/dist/jquery.json.min.js @@ -1,2 +1,2 @@ -/*! jQuery JSON plugin v2.5.1 | github.com/Krinkle/jquery-json */ -!function($){"use strict";var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},hasOwn=Object.prototype.hasOwnProperty;$.toJSON="object"==typeof JSON&&JSON.stringify?JSON.stringify:function(a){if(null===a)return"null";var b,c,d,e,f=$.type(a);if("undefined"===f)return void 0;if("number"===f||"boolean"===f)return String(a);if("string"===f)return $.quoteString(a);if("function"==typeof a.toJSON)return $.toJSON(a.toJSON());if("date"===f){var g=a.getUTCMonth()+1,h=a.getUTCDate(),i=a.getUTCFullYear(),j=a.getUTCHours(),k=a.getUTCMinutes(),l=a.getUTCSeconds(),m=a.getUTCMilliseconds();return 10>g&&(g="0"+g),10>h&&(h="0"+h),10>j&&(j="0"+j),10>k&&(k="0"+k),10>l&&(l="0"+l),100>m&&(m="0"+m),10>m&&(m="0"+m),'"'+i+"-"+g+"-"+h+"T"+j+":"+k+":"+l+"."+m+'Z"'}if(b=[],$.isArray(a)){for(c=0;c + * @license MIT License */ -(function ($) { +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // CommonJS + factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { 'use strict'; var escape = /["\\\x00-\x1f\x7f-\x9f]/g, @@ -197,4 +208,4 @@ return '"' + str + '"'; }; -}(jQuery)); +}));