You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@wordpress/url

Package Overview
Dependencies
Maintainers
25
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/url - npm Package Compare versions

Comparing version
3.4.1
to
3.4.2-next.a55ed9455a.0
+1
-1
build-module/clean-for-slug.js

@@ -27,4 +27,4 @@ /**

return trim(deburr(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-');
return trim(deburr(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-');
}
//# sourceMappingURL=clean-for-slug.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["@wordpress/url/src/clean-for-slug.js"],"names":["deburr","trim","cleanForSlug","string","replace","toLowerCase"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,CAAuBC,MAAvB,EAAgC;AACtC,MAAK,CAAEA,MAAP,EAAgB;AACf,WAAO,EAAP;AACA;;AACD,SAAOF,IAAI,CACVD,MAAM,CAAEG,MAAF,CAAN,CACEC,OADF,CACW,WADX,EACwB,GADxB,EAEEA,OAFF,CAEW,UAFX,EAEuB,EAFvB,EAGEC,WAHF,EADU,EAKV,GALU,CAAX;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, trim } from 'lodash';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param {string} string Title or slug to be processed.\n *\n * @return {string} Processed string.\n */\nexport function cleanForSlug( string ) {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn trim(\n\t\tdeburr( string )\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t.replace( /[^\\w-]+/g, '' )\n\t\t\t.toLowerCase(),\n\t\t'-'\n\t);\n}\n"]}
{"version":3,"sources":["@wordpress/url/src/clean-for-slug.js"],"names":["deburr","trim","cleanForSlug","string","replace","toLowerCase"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,CAAuBC,MAAvB,EAAgC;AACtC,MAAK,CAAEA,MAAP,EAAgB;AACf,WAAO,EAAP;AACA;;AACD,SAAOF,IAAI,CACVD,MAAM,CAAEG,MAAF,CAAN,CACEC,OADF,CACW,WADX,EACwB,GADxB,EAEEA,OAFF,CAEW,oBAFX,EAEiC,EAFjC,EAGEC,WAHF,EADU,EAKV,GALU,CAAX;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, trim } from 'lodash';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param {string} string Title or slug to be processed.\n *\n * @return {string} Processed string.\n */\nexport function cleanForSlug( string ) {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn trim(\n\t\tdeburr( string )\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t.replace( /[^\\p{L}\\p{N}_-]+/gu, '' )\n\t\t\t.toLowerCase(),\n\t\t'-'\n\t);\n}\n"]}

@@ -17,12 +17,14 @@ /**

return base;
} // 'b=1&c=2&a=5'
} // 'b=1%2C2&c=2&a=5'
return base + '?' + query // [ 'b=1', 'c=2', 'a=5' ]
.split('&') // [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map(entry => entry.split('=')) // [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]
.sort((a, b) => a[0].localeCompare(b[0])) // [ 'a=5', 'b=1', 'c=2' ]
.map(pair => pair.join('=')) // 'a=5&b=1&c=2'
return base + '?' + query // [ 'b=1%2C2', 'c=2', 'a=5' ]
.split('&') // [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map(entry => entry.split('=')) // [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map(pair => pair.map(decodeURIComponent)) // [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]
.sort((a, b) => a[0].localeCompare(b[0])) // [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]
.map(pair => pair.map(encodeURIComponent)) // [ 'a=5', 'b=1%2C2', 'c=2' ]
.map(pair => pair.join('=')) // 'a=5&b=1%2C2&c=2'
.join('&');
}
//# sourceMappingURL=normalize-path.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["@wordpress/url/src/normalize-path.js"],"names":["normalizePath","path","splitted","split","query","base","map","entry","sort","a","b","localeCompare","pair","join"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAY,GAAZ,CAAjB;AACA,QAAMC,KAAK,GAAGF,QAAQ,CAAE,CAAF,CAAtB;AACA,QAAMG,IAAI,GAAGH,QAAQ,CAAE,CAAF,CAArB;;AACA,MAAK,CAAEE,KAAP,EAAe;AACd,WAAOC,IAAP;AACA,GANoC,CAQrC;;;AACA,SACCA,IAAI,GACJ,GADA,GAEAD,KAAK,CACJ;AADI,GAEHD,KAFF,CAES,GAFT,EAGC;AAHD,GAIEG,GAJF,CAISC,KAAF,IAAaA,KAAK,CAACJ,KAAN,CAAa,GAAb,CAJpB,EAKC;AALD,GAMEK,IANF,CAMQ,CAAEC,CAAF,EAAKC,CAAL,KAAYD,CAAC,CAAE,CAAF,CAAD,CAAOE,aAAP,CAAsBD,CAAC,CAAE,CAAF,CAAvB,CANpB,EAOC;AAPD,GAQEJ,GARF,CAQSM,IAAF,IAAYA,IAAI,CAACC,IAAL,CAAW,GAAX,CARnB,EASC;AATD,GAUEA,IAVF,CAUQ,GAVR,CAHD;AAeA","sourcesContent":["/**\n * Given a path, returns a normalized path where equal query parameter values\n * will be treated as identical, regardless of order they appear in the original\n * text.\n *\n * @param {string} path Original path.\n *\n * @return {string} Normalized path.\n */\nexport function normalizePath( path ) {\n\tconst splitted = path.split( '?' );\n\tconst query = splitted[ 1 ];\n\tconst base = splitted[ 0 ];\n\tif ( ! query ) {\n\t\treturn base;\n\t}\n\n\t// 'b=1&c=2&a=5'\n\treturn (\n\t\tbase +\n\t\t'?' +\n\t\tquery\n\t\t\t// [ 'b=1', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( entry ) => entry.split( '=' ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]\n\t\t\t.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )\n\t\t\t// [ 'a=5', 'b=1', 'c=2' ]\n\t\t\t.map( ( pair ) => pair.join( '=' ) )\n\t\t\t// 'a=5&b=1&c=2'\n\t\t\t.join( '&' )\n\t);\n}\n"]}
{"version":3,"sources":["@wordpress/url/src/normalize-path.js"],"names":["normalizePath","path","splitted","split","query","base","map","entry","pair","decodeURIComponent","sort","a","b","localeCompare","encodeURIComponent","join"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAY,GAAZ,CAAjB;AACA,QAAMC,KAAK,GAAGF,QAAQ,CAAE,CAAF,CAAtB;AACA,QAAMG,IAAI,GAAGH,QAAQ,CAAE,CAAF,CAArB;;AACA,MAAK,CAAEE,KAAP,EAAe;AACd,WAAOC,IAAP;AACA,GANoC,CAQrC;;;AACA,SACCA,IAAI,GACJ,GADA,GAEAD,KAAK,CACJ;AADI,GAEHD,KAFF,CAES,GAFT,EAGC;AAHD,GAIEG,GAJF,CAISC,KAAF,IAAaA,KAAK,CAACJ,KAAN,CAAa,GAAb,CAJpB,EAKC;AALD,GAMEG,GANF,CAMSE,IAAF,IAAYA,IAAI,CAACF,GAAL,CAAUG,kBAAV,CANnB,EAOC;AAPD,GAQEC,IARF,CAQQ,CAAEC,CAAF,EAAKC,CAAL,KAAYD,CAAC,CAAE,CAAF,CAAD,CAAOE,aAAP,CAAsBD,CAAC,CAAE,CAAF,CAAvB,CARpB,EASC;AATD,GAUEN,GAVF,CAUSE,IAAF,IAAYA,IAAI,CAACF,GAAL,CAAUQ,kBAAV,CAVnB,EAWC;AAXD,GAYER,GAZF,CAYSE,IAAF,IAAYA,IAAI,CAACO,IAAL,CAAW,GAAX,CAZnB,EAaC;AAbD,GAcEA,IAdF,CAcQ,GAdR,CAHD;AAmBA","sourcesContent":["/**\n * Given a path, returns a normalized path where equal query parameter values\n * will be treated as identical, regardless of order they appear in the original\n * text.\n *\n * @param {string} path Original path.\n *\n * @return {string} Normalized path.\n */\nexport function normalizePath( path ) {\n\tconst splitted = path.split( '?' );\n\tconst query = splitted[ 1 ];\n\tconst base = splitted[ 0 ];\n\tif ( ! query ) {\n\t\treturn base;\n\t}\n\n\t// 'b=1%2C2&c=2&a=5'\n\treturn (\n\t\tbase +\n\t\t'?' +\n\t\tquery\n\t\t\t// [ 'b=1%2C2', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( entry ) => entry.split( '=' ) )\n\t\t\t// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( pair ) => pair.map( decodeURIComponent ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]\n\t\t\t.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]\n\t\t\t.map( ( pair ) => pair.map( encodeURIComponent ) )\n\t\t\t// [ 'a=5', 'b=1%2C2', 'c=2' ]\n\t\t\t.map( ( pair ) => pair.join( '=' ) )\n\t\t\t// 'a=5&b=1%2C2&c=2'\n\t\t\t.join( '&' )\n\t);\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../src/normalize-path.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,oCAJW,MAAM,GAEL,MAAM,CA0BjB"}
{"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../src/normalize-path.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,oCAJW,MAAM,GAEL,MAAM,CA8BjB"}

@@ -35,4 +35,4 @@ "use strict";

return (0, _lodash.trim)((0, _lodash.deburr)(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-');
return (0, _lodash.trim)((0, _lodash.deburr)(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-');
}
//# sourceMappingURL=clean-for-slug.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["@wordpress/url/src/clean-for-slug.js"],"names":["cleanForSlug","string","replace","toLowerCase"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,MAAvB,EAAgC;AACtC,MAAK,CAAEA,MAAP,EAAgB;AACf,WAAO,EAAP;AACA;;AACD,SAAO,kBACN,oBAAQA,MAAR,EACEC,OADF,CACW,WADX,EACwB,GADxB,EAEEA,OAFF,CAEW,UAFX,EAEuB,EAFvB,EAGEC,WAHF,EADM,EAKN,GALM,CAAP;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, trim } from 'lodash';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param {string} string Title or slug to be processed.\n *\n * @return {string} Processed string.\n */\nexport function cleanForSlug( string ) {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn trim(\n\t\tdeburr( string )\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t.replace( /[^\\w-]+/g, '' )\n\t\t\t.toLowerCase(),\n\t\t'-'\n\t);\n}\n"]}
{"version":3,"sources":["@wordpress/url/src/clean-for-slug.js"],"names":["cleanForSlug","string","replace","toLowerCase"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,MAAvB,EAAgC;AACtC,MAAK,CAAEA,MAAP,EAAgB;AACf,WAAO,EAAP;AACA;;AACD,SAAO,kBACN,oBAAQA,MAAR,EACEC,OADF,CACW,WADX,EACwB,GADxB,EAEEA,OAFF,CAEW,oBAFX,EAEiC,EAFjC,EAGEC,WAHF,EADM,EAKN,GALM,CAAP;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, trim } from 'lodash';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param {string} string Title or slug to be processed.\n *\n * @return {string} Processed string.\n */\nexport function cleanForSlug( string ) {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn trim(\n\t\tdeburr( string )\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t.replace( /[^\\p{L}\\p{N}_-]+/gu, '' )\n\t\t\t.toLowerCase(),\n\t\t'-'\n\t);\n}\n"]}

@@ -24,12 +24,14 @@ "use strict";

return base;
} // 'b=1&c=2&a=5'
} // 'b=1%2C2&c=2&a=5'
return base + '?' + query // [ 'b=1', 'c=2', 'a=5' ]
.split('&') // [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map(entry => entry.split('=')) // [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]
.sort((a, b) => a[0].localeCompare(b[0])) // [ 'a=5', 'b=1', 'c=2' ]
.map(pair => pair.join('=')) // 'a=5&b=1&c=2'
return base + '?' + query // [ 'b=1%2C2', 'c=2', 'a=5' ]
.split('&') // [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map(entry => entry.split('=')) // [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map(pair => pair.map(decodeURIComponent)) // [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]
.sort((a, b) => a[0].localeCompare(b[0])) // [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]
.map(pair => pair.map(encodeURIComponent)) // [ 'a=5', 'b=1%2C2', 'c=2' ]
.map(pair => pair.join('=')) // 'a=5&b=1%2C2&c=2'
.join('&');
}
//# sourceMappingURL=normalize-path.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["@wordpress/url/src/normalize-path.js"],"names":["normalizePath","path","splitted","split","query","base","map","entry","sort","a","b","localeCompare","pair","join"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAY,GAAZ,CAAjB;AACA,QAAMC,KAAK,GAAGF,QAAQ,CAAE,CAAF,CAAtB;AACA,QAAMG,IAAI,GAAGH,QAAQ,CAAE,CAAF,CAArB;;AACA,MAAK,CAAEE,KAAP,EAAe;AACd,WAAOC,IAAP;AACA,GANoC,CAQrC;;;AACA,SACCA,IAAI,GACJ,GADA,GAEAD,KAAK,CACJ;AADI,GAEHD,KAFF,CAES,GAFT,EAGC;AAHD,GAIEG,GAJF,CAISC,KAAF,IAAaA,KAAK,CAACJ,KAAN,CAAa,GAAb,CAJpB,EAKC;AALD,GAMEK,IANF,CAMQ,CAAEC,CAAF,EAAKC,CAAL,KAAYD,CAAC,CAAE,CAAF,CAAD,CAAOE,aAAP,CAAsBD,CAAC,CAAE,CAAF,CAAvB,CANpB,EAOC;AAPD,GAQEJ,GARF,CAQSM,IAAF,IAAYA,IAAI,CAACC,IAAL,CAAW,GAAX,CARnB,EASC;AATD,GAUEA,IAVF,CAUQ,GAVR,CAHD;AAeA","sourcesContent":["/**\n * Given a path, returns a normalized path where equal query parameter values\n * will be treated as identical, regardless of order they appear in the original\n * text.\n *\n * @param {string} path Original path.\n *\n * @return {string} Normalized path.\n */\nexport function normalizePath( path ) {\n\tconst splitted = path.split( '?' );\n\tconst query = splitted[ 1 ];\n\tconst base = splitted[ 0 ];\n\tif ( ! query ) {\n\t\treturn base;\n\t}\n\n\t// 'b=1&c=2&a=5'\n\treturn (\n\t\tbase +\n\t\t'?' +\n\t\tquery\n\t\t\t// [ 'b=1', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( entry ) => entry.split( '=' ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]\n\t\t\t.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )\n\t\t\t// [ 'a=5', 'b=1', 'c=2' ]\n\t\t\t.map( ( pair ) => pair.join( '=' ) )\n\t\t\t// 'a=5&b=1&c=2'\n\t\t\t.join( '&' )\n\t);\n}\n"]}
{"version":3,"sources":["@wordpress/url/src/normalize-path.js"],"names":["normalizePath","path","splitted","split","query","base","map","entry","pair","decodeURIComponent","sort","a","b","localeCompare","encodeURIComponent","join"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAY,GAAZ,CAAjB;AACA,QAAMC,KAAK,GAAGF,QAAQ,CAAE,CAAF,CAAtB;AACA,QAAMG,IAAI,GAAGH,QAAQ,CAAE,CAAF,CAArB;;AACA,MAAK,CAAEE,KAAP,EAAe;AACd,WAAOC,IAAP;AACA,GANoC,CAQrC;;;AACA,SACCA,IAAI,GACJ,GADA,GAEAD,KAAK,CACJ;AADI,GAEHD,KAFF,CAES,GAFT,EAGC;AAHD,GAIEG,GAJF,CAISC,KAAF,IAAaA,KAAK,CAACJ,KAAN,CAAa,GAAb,CAJpB,EAKC;AALD,GAMEG,GANF,CAMSE,IAAF,IAAYA,IAAI,CAACF,GAAL,CAAUG,kBAAV,CANnB,EAOC;AAPD,GAQEC,IARF,CAQQ,CAAEC,CAAF,EAAKC,CAAL,KAAYD,CAAC,CAAE,CAAF,CAAD,CAAOE,aAAP,CAAsBD,CAAC,CAAE,CAAF,CAAvB,CARpB,EASC;AATD,GAUEN,GAVF,CAUSE,IAAF,IAAYA,IAAI,CAACF,GAAL,CAAUQ,kBAAV,CAVnB,EAWC;AAXD,GAYER,GAZF,CAYSE,IAAF,IAAYA,IAAI,CAACO,IAAL,CAAW,GAAX,CAZnB,EAaC;AAbD,GAcEA,IAdF,CAcQ,GAdR,CAHD;AAmBA","sourcesContent":["/**\n * Given a path, returns a normalized path where equal query parameter values\n * will be treated as identical, regardless of order they appear in the original\n * text.\n *\n * @param {string} path Original path.\n *\n * @return {string} Normalized path.\n */\nexport function normalizePath( path ) {\n\tconst splitted = path.split( '?' );\n\tconst query = splitted[ 1 ];\n\tconst base = splitted[ 0 ];\n\tif ( ! query ) {\n\t\treturn base;\n\t}\n\n\t// 'b=1%2C2&c=2&a=5'\n\treturn (\n\t\tbase +\n\t\t'?' +\n\t\tquery\n\t\t\t// [ 'b=1%2C2', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( entry ) => entry.split( '=' ) )\n\t\t\t// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( pair ) => pair.map( decodeURIComponent ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]\n\t\t\t.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]\n\t\t\t.map( ( pair ) => pair.map( encodeURIComponent ) )\n\t\t\t// [ 'a=5', 'b=1%2C2', 'c=2' ]\n\t\t\t.map( ( pair ) => pair.join( '=' ) )\n\t\t\t// 'a=5&b=1%2C2&c=2'\n\t\t\t.join( '&' )\n\t);\n}\n"]}
{
"name": "@wordpress/url",
"version": "3.4.1",
"version": "3.4.2-next.a55ed9455a.0",
"description": "WordPress URL utilities.",

@@ -36,3 +36,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "2e4922861e49f5a090f9dc52056165092cfba163"
"gitHead": "c5108185851b824d531bce55991a3589947e8551"
}

@@ -29,3 +29,3 @@ /**

.replace( /[\s\./]+/g, '-' )
.replace( /[^\w-]+/g, '' )
.replace( /[^\p{L}\p{N}_-]+/gu, '' )
.toLowerCase(),

@@ -32,0 +32,0 @@ '-'

@@ -18,3 +18,3 @@ /**

// 'b=1&c=2&a=5'
// 'b=1%2C2&c=2&a=5'
return (

@@ -24,13 +24,17 @@ base +

query
// [ 'b=1', 'c=2', 'a=5' ]
// [ 'b=1%2C2', 'c=2', 'a=5' ]
.split( '&' )
// [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]
// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map( ( entry ) => entry.split( '=' ) )
// [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]
// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]
.map( ( pair ) => pair.map( decodeURIComponent ) )
// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]
.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )
// [ 'a=5', 'b=1', 'c=2' ]
// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]
.map( ( pair ) => pair.map( encodeURIComponent ) )
// [ 'a=5', 'b=1%2C2', 'c=2' ]
.map( ( pair ) => pair.join( '=' ) )
// 'a=5&b=1&c=2'
// 'a=5&b=1%2C2&c=2'
.join( '&' )
);
}

@@ -977,13 +977,29 @@ /**

describe( 'cleanForSlug', () => {
it( 'should return string prepared for use as url slug', () => {
it( 'Should return string prepared for use as url slug', () => {
expect( cleanForSlug( '/Is th@t Déjà_vu? ' ) ).toBe( 'is-tht-deja_vu' );
} );
it( 'should return an empty string for missing argument', () => {
it( 'Should return an empty string for missing argument', () => {
expect( cleanForSlug() ).toBe( '' );
} );
it( 'should return an empty string for falsy argument', () => {
it( 'Should return an empty string for falsy argument', () => {
expect( cleanForSlug( null ) ).toBe( '' );
} );
it( 'Should not allow characters used internally in rich-text', () => {
//The last space is an object replacement character
expect( cleanForSlug( 'the long cat' ) ).toBe( 'the-long-cat' );
} );
it( 'Creates a slug for languages that use multibyte encodings', () => {
expect( cleanForSlug( '新荣记 ' ) ).toBe( '新荣记' );
expect( cleanForSlug( '私のテンプレートパーツのテスト ' ) ).toBe(
'私のテンプレートパーツのテスト'
);
expect( cleanForSlug( 'ქართული ნაწილი' ) ).toBe( 'ქართული-ნაწილი' );
expect( cleanForSlug( 'Καλημέρα Κόσμε' ) ).toBe( 'καλημέρα-κόσμε' );
expect( cleanForSlug( '안녕하세요 ' ) ).toBe( '안녕하세요' );
expect( cleanForSlug( '繁体字 ' ) ).toBe( '繁体字' );
} );
} );

@@ -1012,2 +1028,7 @@

} );
it( 'sorts urldecoded values and returns property urlencoded query string', () => {
const ab = normalizePath( '/foo/bar?a%2Ca=5,5&a,b=1,1' );
expect( ab ).toBe( '/foo/bar?a%2Ca=5%2C5&a%2Cb=1%2C1' );
} );
} );

Sorry, the diff of this file is not supported yet