8000 GitHub - jtacoma/stubble.js: Lookup and localize into object properties.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jtacoma/stubble.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stubble.js

stubble.js was conceived in need for a way to late-bind localized strings to properties of an object, prior to pretty-printing with mustache.js. It may be useful for other purposes.

Usage

stubble() will copy property-value pairs from a source to a target with some mapping and localization. In the code below, we setup a source and a target, then copy a localized property-value pair into the target:

var localizedStrings = {
  dayOfWeek_name_en: 'Sunday Monday Tuesday etc.'.split(),
};
var datum = { dayOfWeek: 1 };
datum.stubble({source:localizedStrings, language:'en'});

After this, datum.dayOfWeek_name == 'Monday'.

Building

On *nix:

cat src/* > stubble.js

or at a DOS prompt:

type src\* > stubble.js

Developing

stubble.js is under src. Jasmine specifications are under spec.

Collaborators welcome. Feel free to fork the github project and send pull requests.

Copyright © 2011 Joshua Tacoma. This software is licensed under the MIT License.

About

Lookup and localize into object properties.

Resources

Stars

Watchers

Forks

Packages

No packages published
0