Skip to content

Commit

Permalink
fix: cherry pick lodash modules (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
tychenjiajun authored Aug 27, 2020
1 parent 85610d6 commit 003ef1c
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 55 deletions.
5 changes: 2 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ var ARGV = require("yargs").
argv;

var webpack = require("webpack-stream"),
lodash = require("lodash"),
gulp = require("gulp"),
gutil = require("gulp-util"),
karma = require("karma"),
mocha = require("gulp-mocha"),
istanbul = require("gulp-istanbul"),
del = require("del");

var clone = lodash.clone;
var merge = lodash.merge;
var clone = require("lodash/clone");
var merge = require("lodash/merge");
// ### 'CONSTANTS' ###
var SOURCES = ["./lib/**/*.js", "!(./lib/old/**/*.js)"],
TESTS = "./test/**/*-test.js";
Expand Down
2 changes: 1 addition & 1 deletion lib/algorithms/ec-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

var clone = require("lodash").clone,
var clone = require("lodash/clone"),
ecc = require("../deps/ecc"),
forge = require("../deps/forge.js"),
util = require("../util");
Expand Down
9 changes: 4 additions & 5 deletions lib/algorithms/ecdh.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
*/
"use strict";

var lodash = require("lodash"),
merge = require("../util/merge"),
var merge = require("../util/merge"),
util = require("../util"),
ecUtil = require("./ec-util.js"),
hkdf = require("./hkdf.js"),
Expand All @@ -15,9 +14,9 @@ var lodash = require("lodash"),
helpers = require("./helpers.js"),
CONSTANTS = require("./constants.js");

var clone = lodash.clone;
var omit = lodash.omit;
var pick = lodash.pick;
var clone = require("lodash/clone");
var omit = require("lodash/omit");
var pick = require("lodash/pick");

function idealHash(curve) {
switch (curve) {
Expand Down
2 changes: 1 addition & 1 deletion lib/algorithms/rsa-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

var clone = require("lodash").clone,
var clone = require("lodash/clone"),
forge = require("../deps/forge.js"),
util = require("../util");

Expand Down
2 changes: 1 addition & 1 deletion lib/deps/ciphermodes/gcm/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"use strict";

var Long = require("long"),
fill = require("lodash").fill,
fill = require("lodash/fill"),
pack = require("../pack.js");

var E1 = 0xe1000000,
Expand Down
8 changes: 3 additions & 5 deletions lib/jwe/encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
*/
"use strict";

var lodash = require("lodash"),
util = require("../util"),
var util = require("../util"),
generateCEK = require("./helpers").generateCEK,
JWK = require("../jwk"),
slice = require("./helpers").slice,
pako = require("pako"),
CONSTANTS = require("../algorithms/constants");

var assign = lodash.assign;
var clone = lodash.clone;

var assign = require("lodash/assign");
var clone = require("lodash/clone");
var DEFAULTS = require("./defaults");

/**
Expand Down
17 changes: 8 additions & 9 deletions lib/jwk/basekey.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
*/
"use strict";

var lodash = require("lodash"),
merge = require("../util/merge"),
var merge = require("../util/merge"),
uuid = require("uuid");

var assign = lodash.assign;
var clone = lodash.clone;
var flatten = lodash.flatten;
var intersection = lodash.intersection;
var omit = lodash.omit;
var pick = lodash.pick;
var uniq = lodash.uniq;
var assign = require("lodash/assign");
var clone = require("lodash/clone");
var flatten = require("lodash/flatten");
var intersection = require("lodash/intersection");
var omit = require("lodash/omit");
var pick = require("lodash/pick");
var uniq = require("lodash/uniq");

var ALGORITHMS = require("../algorithms"),
CONSTANTS = require("./constants.js"),
Expand Down
2 changes: 1 addition & 1 deletion lib/jwk/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

var clone = require("lodash").clone,
var clone = require("lodash/clone"),
util = require("../util"),
forge = require("../deps/forge");

Expand Down
2 changes: 1 addition & 1 deletion lib/jwk/keystore.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

var clone = require("lodash").clone,
var clone = require("lodash/clone"),
merge = require("../util/merge"),
forge = require("../deps/forge"),
util = require("../util");
Expand Down
7 changes: 3 additions & 4 deletions lib/jws/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
*/
"use strict";

var lodash = require("lodash"),
merge = require("../util/merge"),
var merge = require("../util/merge"),
util = require("../util"),
JWK = require("../jwk"),
slice = require("./helpers").slice;

var clone = lodash.clone;
var uniq = lodash.uniq;
var clone = require("lodash/clone");
var uniq = require("lodash/uniq");

var DEFAULTS = require("./defaults");

Expand Down
2 changes: 1 addition & 1 deletion lib/jws/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

var clone = require("lodash").clone,
var clone = require("lodash/clone"),
merge = require("../util/merge"),
base64url = require("../util/base64url"),
AlgConfig = require("../util/algconfig"),
Expand Down
6 changes: 2 additions & 4 deletions lib/util/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
*/
"use strict";

var lodash = require("lodash");

var partialRight = lodash.partialRight;
var merge = lodash.merge;
var partialRight = require("lodash/partialRight");
var merge = require("lodash/merge");

var typedArrayCtors = (function() {
var ctors = [];
Expand Down
2 changes: 1 addition & 1 deletion test/algorithms/ecdh-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
"use strict";

var omit = require("lodash").omit,
var omit = require("lodash/omit"),
chai = require("chai"),
bowser = require("bowser");
var assert = chai.assert;
Expand Down
2 changes: 1 addition & 1 deletion test/jwe/invalidecdh-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

var forEach = require("lodash").forEach;
var forEach = require("lodash/forEach")
var chai = require("chai");

var JWE = require("../../lib/jwe"),
Expand Down
4 changes: 2 additions & 2 deletions test/jwe/jwe-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
"use strict";

var cloneDeep = require("lodash").cloneDeep;
var forEach = require("lodash").forEach;
var cloneDeep = require("lodash/cloneDeep");
var forEach = require("lodash/forEach")
var chai = require("chai");

var JWE = require("../../lib/jwe"),
Expand Down
2 changes: 1 addition & 1 deletion test/jwe/roundtrip-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var forEach = require("lodash").forEach;
var forEach = require("lodash/forEach")
var chai = require("chai");

var JWE = require("../../lib/jwe"),
Expand Down
8 changes: 4 additions & 4 deletions test/jwk/eckey-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"use strict";

var chai = require("chai"),
bind = require("lodash").bind,
clone = require("lodash").clone,
bind = require("lodash/bind"),
clone = require("lodash/clone"),
merge = require("../../lib/util/merge"),
omit = require("lodash").omit,
pick = require("lodash").pick;
omit = require("lodash/omit"),
pick = require("lodash/pick");
var assert = chai.assert;

var JWK = {
Expand Down
2 changes: 1 addition & 1 deletion test/jwk/octkey-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var chai = require("chai"),
forge = require("node-forge"),
clone = require("lodash").clone,
clone = require("lodash/clone"),
merge = require("../../lib/util/merge");
var assert = chai.assert;

Expand Down
8 changes: 4 additions & 4 deletions test/jwk/rsakey-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"use strict";

var chai = require("chai");
var bind = require("lodash").bind;
var clone = require("lodash").clone;
var bind = require("lodash/bind");
var clone = require("lodash/clone");
var merge = require("../../lib/util/merge");
var omit = require("lodash").omit;
var pick = require("lodash").pick;
var omit = require("lodash/omit");
var pick = require("lodash/pick");
var assert = chai.assert;

var JWK = {
Expand Down
4 changes: 2 additions & 2 deletions test/jws/jws-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
"use strict";

var cloneDeep = require("lodash").cloneDeep;
var forEach = require("lodash").forEach;
var cloneDeep = require("lodash/cloneDeep");
var forEach = require("lodash/forEach")
var chai = require("chai");
var bowser = require("bowser");

Expand Down
2 changes: 1 addition & 1 deletion test/parse/compact-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var chai = require("chai");
var assert = chai.assert;

var cloneDeep = require("lodash").cloneDeep;
var cloneDeep = require("lodash/cloneDeep");
var parseCompact = require("../../lib/parse/compact");
var jose = {
JWK: require("../../lib/jwk")
Expand Down
2 changes: 1 addition & 1 deletion test/parse/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var chai = require("chai");
var assert = chai.assert;

var cloneDeep = require("lodash").cloneDeep;
var cloneDeep = require("lodash/cloneDeep");
var merge = require("../../lib/util/merge");

var jose = {
Expand Down
2 changes: 1 addition & 1 deletion test/parse/json-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var chai = require("chai");
var assert = chai.assert;

var cloneDeep = require("lodash").cloneDeep;
var cloneDeep = require("lodash/cloneDeep");
var merge = require("../../lib/util/merge");
var parseJSON = require("../../lib/parse/json");

Expand Down

0 comments on commit 003ef1c

Please sign in to comment.