forked from elastic/eui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved to lodash 3.10.1 (to align with Kibana) (elastic#359)
- created a `predicate` module that exports all predicate function (e.g. `isString`, `isFunction`,...) - created `isNil` predicate - `sortable_properties` no longer uses lodash `sortBy` and uses our comparators instaed this change should enable using tables in Kibana.
- Loading branch information
Showing
18 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const always = () => true; | ||
|
||
export const never = () => false; | ||
|
||
export const isUndefined = (value) => { | ||
return value === undefined; | ||
}; | ||
|
||
export const isNull = (value) => { | ||
return value === null; | ||
}; | ||
|
||
export const isNil = (value) => { | ||
return isUndefined(value) || isNull(value); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { always, never, isNil, isUndefined, isNull } from './common_predicates'; | ||
|
||
describe('common predicates', () => { | ||
|
||
test('always', () => { | ||
[ undefined, null, 'a', 1, true, false, Date.now(), {}, [], /.*/ ].forEach(value => { | ||
expect(always(value)).toBe(true); | ||
}); | ||
}); | ||
|
||
test('never', () => { | ||
[ undefined, null, 'a', 1, true, false, Date.now(), {}, [], /.*/ ].forEach(value => { | ||
expect(never(value)).toBe(false); | ||
}); | ||
}); | ||
|
||
test('isUndefined', () => { | ||
[ undefined ].forEach(value => { | ||
expect(isUndefined(value)).toBe(true); | ||
}); | ||
[ null, 'a', 1, true, false, Date.now(), {}, [], /.*/ ].forEach(value => { | ||
expect(isUndefined(value)).toBe(false); | ||
}); | ||
}); | ||
|
||
test('isNull', () => { | ||
[ null ].forEach(value => { | ||
expect(isNull(value)).toBe(true); | ||
}); | ||
[ undefined, 'a', 1, true, false, Date.now(), {}, [], /.*/ ].forEach(value => { | ||
expect(isNull(value)).toBe(false); | ||
}); | ||
}); | ||
|
||
test('isNil', () => { | ||
[ undefined, null ].forEach(value => { | ||
expect(isNil(value)).toBe(true); | ||
}); | ||
[ 'a', 1, true, false, Date.now(), {}, [], /.*/ ].forEach(value => { | ||
expect(isNil(value)).toBe(false); | ||
}); | ||
}); | ||
|
||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './common_predicates'; | ||
export * from './lodash_predicates'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { | ||
isFunction, | ||
isArray, | ||
isString, | ||
isBoolean, | ||
isDate, | ||
isNumber, | ||
isNaN, | ||
} from 'lodash'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { isNil } from 'lodash'; | ||
import { isNil } from './predicate'; | ||
|
||
const defaultRand = Math.random; | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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