made with requirebin
Last active
August 29, 2016 19:44
-
-
Save guiprav/c925592f45160dc3cf9a957d49922909 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formurlencoded = require('form-urlencoded'); | |
var obj = { | |
contactInfo: [ | |
{ type: 'email', value: 'example1', business: 1 }, | |
{ type: 'phone', value: 'example2' }, | |
], | |
}; | |
document.write(decodeURIComponent(formurlencoded(obj))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function(){require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"form-urlencoded":[function(require,module,exports){var formurlencoded=module.exports=function(data,opts){var encodechar=new RegExp(['(?:[\x00-"-&+-}--]|',"[�-�][�-�]|[�-�](?![�-�])|","(?:[^�-�]|^)[�-�])"].join(""),"g");opts=typeof opts==="object"?opts:{};function encode(value){return String(value).replace(encodechar,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,function(ch){return"%"+ch.charCodeAt().toString(16).slice(-2).toUpperCase()})}function keys(obj){var keys=Object.keys(obj);return opts.sorted?keys.sort():keys}function filterjoin(arr){return arr.filter(function(e){return e}).join("&")}function objnest(name,obj){return filterjoin(keys(obj).map(function(key){return nest(name+"["+key+"]",obj[key])}))}function arrnest(name,arr){return arr.length?filterjoin(arr.map(function(elem){return nest(name+"[]",elem)})):encode(name+"[]")}function nest(name,value){var type=typeof value,f=null;if(value===f){f=opts.ignorenull?f:encode(name)+"="+f}else if(/string|number|boolean/.test(type)){f=encode(name)+"="+encode(value)}else if(Array.isArray(value)){f=arrnest(name,value)}else if(type==="object"){f=objnest(name,value)}return f}return data&&filterjoin(keys(data).map(function(key){return nest(key,data[key])}))}},{}]},{},[]);var formurlencoded=require("form-urlencoded");var obj={contactInfo:[{type:"email",value:"example1",business:1},{type:"phone",value:"example2"}]};document.write(decodeURIComponent(formurlencoded(obj)))},0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"form-urlencoded": "1.4.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment