Skip to content

Commit 8567e7d

Browse files
committed
extract identity function into util
1 parent cdd3687 commit 8567e7d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/core/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow */
22

3-
import { no, noop } from 'shared/util'
3+
import { no, noop, identity } from 'shared/util'
44

55
export type Config = {
66
// user
@@ -73,7 +73,7 @@ const config: Config = {
7373
/**
7474
* Parse the real tag name for the specific platform.
7575
*/
76-
parsePlatformTagName: (x: string): string => x,
76+
parsePlatformTagName: identity,
7777

7878
/**
7979
* Check if an attribute must be bound using property, e.g. value

src/core/instance/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import VNode, {
99
} from '../vdom/vnode'
1010
import {
1111
warn,
12+
identity,
1213
isObject,
1314
toObject,
1415
nextTick,
@@ -167,7 +168,6 @@ export function renderMixin (Vue: Class<Component>) {
167168
}
168169

169170
// filter resolution helper
170-
const identity = _ => _
171171
Vue.prototype._f = function resolveFilter (id) {
172172
return resolveAsset(this.$options, 'filters', id, true) || identity
173173
}

src/shared/util.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ export function noop () {}
189189
*/
190190
export const no = () => false
191191

192+
/**
193+
* Return same value
194+
*/
195+
export const identity = (_: any) => _
196+
192197
/**
193198
* Generate a static keys string from compiler modules.
194199
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy