From 7f781c3e2261e1f9ebd153755097b2484e349663 Mon Sep 17 00:00:00 2001 From: Dmitry Ermakov Date: Fri, 25 Sep 2015 13:10:34 +0300 Subject: [PATCH 1/5] package: Add "main" property for webpack resolving Closes #71. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 3fc343c..946341c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "LICENSE.txt", "README.md" ], + "main": "./src/jquery.json.js", "devDependencies": { "grunt": "0.4.5", "grunt-cli": "0.1.13", From 7e65d5d9b1636f1ac990887b5cf61b7ac6f89b85 Mon Sep 17 00:00:00 2001 From: Stavros Zavrakas Date: Fri, 19 Aug 2016 09:21:48 +0100 Subject: [PATCH 2/5] Export the library as amd module Fixes #57. --- .jshintrc | 4 +++- dist/jquery.json.min.js | 2 +- src/jquery.json.js | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) 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/dist/jquery.json.min.js b/dist/jquery.json.min.js index 44e246f..01da64c 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 */ -(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)); +})); From b63decb53e1cc39b0062ce1e5e049ce311fe6f13 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 19 Aug 2016 12:35:19 -0700 Subject: [PATCH 3/5] build: Update dev dependencies --- .jscsrc | 1 + Gruntfile.js | 9 --------- LICENSE.txt | 2 +- package.json | 16 +++++++--------- src/jquery.json.js | 4 ++-- 5 files changed, 11 insertions(+), 21 deletions(-) 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/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/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/package.json b/package.json index 946341c..8d2439e 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,13 @@ ], "main": "./src/jquery.json.js", "devDependencies": { - "grunt": "0.4.5", - "grunt-cli": "0.1.13", - "grunt-contrib-connect": "0.10.1", - "grunt-contrib-jshint": "0.11.2", - "grunt-contrib-qunit": "0.7.0", - "grunt-contrib-uglify": "0.9.1", - "grunt-contrib-watch": "0.6.1", - "grunt-jscs": "1.6.0", + "grunt": "1.0.1", + "grunt-contrib-connect": "1.0.2", + "grunt-contrib-jshint": "1.0.0", + "grunt-contrib-qunit": "1.2.0", + "grunt-contrib-uglify": "2.0.0", + "grunt-jscs": "3.0.1", "jquery": "1.11.2", - "qunitjs": "1.18.0" + "qunitjs": "2.0.1" } } diff --git a/src/jquery.json.js b/src/jquery.json.js index bbdca17..daec52c 100644 --- a/src/jquery.json.js +++ b/src/jquery.json.js @@ -3,14 +3,14 @@ * https://github.com/Krinkle/jquery-json * * @author Brantley Harris, 2009-2011 - * @author Timo Tijhof, 2011-2014 + * @author Timo Tijhof, 2011-2016 * @source This plugin is heavily influenced by MochiKit's serializeJSON, which is * copyrighted 2005 by Bob Ippolito. * @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org * website's http://www.json.org/json2.js, which proclaims: * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that * I uphold. - * @license MIT License + * @license MIT License */ (function (factory) { if (typeof define === 'function' && define.amd) { From 23398043f780ea88b6f78ecd0b09268ed888e584 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 19 Aug 2016 12:37:21 -0700 Subject: [PATCH 4/5] Release v2.6.0 --- HISTORY.md | 4 ++++ dist/jquery.json.min.js | 2 +- package.json | 2 +- src/jquery.json.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) 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/dist/jquery.json.min.js b/dist/jquery.json.min.js index 01da64c..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 */ +/*! jQuery JSON plugin v2.6.0 | github.com/Krinkle/jquery-json */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function($){"use strict";var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b","\t":"\\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){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 g<10&&(g="0"+g),h<10&&(h="0"+h),j<10&&(j="0"+j),k<10&&(k="0"+k),l<10&&(l="0"+l),m<100&&(m="0"+m),m<10&&(m="0"+m),'"'+i+"-"+g+"-"+h+"T"+j+":"+k+":"+l+"."+m+'Z"'}if(b=[],$.isArray(a)){for(c=0;c Date: Thu, 29 Feb 2024 18:06:35 +0000 Subject: [PATCH 5/5] readme: Remove Travis, update badges --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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