nemo-locatex
Advanced tools
Comparing version 0.4.0 to 0.4.1
51
index.js
/*───────────────────────────────────────────────────────────────────────────*\ | ||
│ Copyright (C) 2014 eBay Software Foundation │ | ||
│ │ | ||
│ │ | ||
│ Licensed under the Apache License, Version 2.0 (the 'License'); you may │ | ||
│ not use this file except in compliance with the License. You may obtain │ | ||
│ a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 │ | ||
│ │ | ||
│ Unless required by applicable law or agreed to in writing, software │ | ||
│ distributed under the License is distributed on an 'AS IS' BASIS, │ | ||
│ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │ | ||
│ See the License for the specific language governing permissions and │ | ||
│ limitations under the License. │ | ||
\*───────────────────────────────────────────────────────────────────────────*/ | ||
│ Copyright (C) 2014 eBay Software Foundation │ | ||
│ │ | ||
│ │ | ||
│ Licensed under the Apache License, Version 2.0 (the 'License'); you may │ | ||
│ not use this file except in compliance with the License. You may obtain │ | ||
│ a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 │ | ||
│ │ | ||
│ Unless required by applicable law or agreed to in writing, software │ | ||
│ distributed under the License is distributed on an 'AS IS' BASIS, │ | ||
│ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │ | ||
│ See the License for the specific language governing permissions and │ | ||
│ limitations under the License. │ | ||
\*───────────────────────────────────────────────────────────────────────────*/ | ||
/* global module: true */ | ||
'use strict'; | ||
module.exports = { | ||
'setup': function (config, result, callback) { | ||
var returnObj = result; | ||
returnObj.locatex = function locatex(_locator) { | ||
var locale = (result.props && result.props.locale) ? result.props.locale : 'default', | ||
locatr = this.locator; | ||
_locator.split('.').forEach(function (level) { | ||
locatr = locatr[level]; | ||
}); | ||
return locatr[locale] || locatr['default'] || locatr; | ||
'setup': function (config, nemo, callback) { | ||
nemo.locatex = function locatex(_locator) { | ||
var locale = (nemo.props && nemo.props.locale) ? nemo.props.locale : 'default', | ||
args = Array.prototype.slice.call(arguments), | ||
locatorArray = (args.length > 1) ? args : arguments[0].split('.'), | ||
locatr = nemo.locator; | ||
locatorArray.forEach(function (level) { | ||
locatr = locatr[level]; | ||
}); | ||
return locatr[locale] || locatr['default'] || locatr; | ||
}.bind(result); | ||
callback(null, config, returnObj); | ||
} | ||
}; | ||
callback(null, config, nemo); | ||
} | ||
}; |
{ | ||
"name": "nemo-locatex", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Add Locale behavior to Nemo locators", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13801
78