-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # components/bower.json # components/handlebars.js.nuspec # components/package.json # package.json
- Loading branch information
Showing
18 changed files
with
550 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
export const dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/; | ||
|
||
export default function(instance) { | ||
instance.registerHelper('lookup', function(obj, field) { | ||
instance.registerHelper('lookup', function(obj, field, options) { | ||
if (!obj) { | ||
// Note for 5.0: Change to "obj == null" in 5.0 | ||
return obj; | ||
} | ||
if ( | ||
dangerousPropertyRegex.test(String(field)) && | ||
!Object.prototype.propertyIsEnumerable.call(obj, field) | ||
) { | ||
return undefined; | ||
} | ||
return obj[field]; | ||
return options.lookupProperty(obj, field); | ||
}); | ||
} |
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,11 @@ | ||
import { extend } from '../utils'; | ||
|
||
/** | ||
* Create a new object with "null"-prototype to avoid truthy results on prototype properties. | ||
* The resulting object can be used with "object[property]" to check if a property exists | ||
* @param {...object} sources a varargs parameter of source objects that will be merged | ||
* @returns {object} | ||
*/ | ||
export function createNewLookupObject(...sources) { | ||
return extend(Object.create(null), ...sources); | ||
} |
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,8 @@ | ||
export function wrapHelper(helper, transformOptionsFn) { | ||
let wrapper = function(/* dynamic arguments */) { | ||
const options = arguments[arguments.length - 1]; | ||
arguments[arguments.length - 1] = transformOptionsFn(options); | ||
return helper.apply(this, arguments); | ||
}; | ||
return wrapper; | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.