Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

frenchkiss

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frenchkiss - npm Package Compare versions

Comparing version 0.0.11 to 0.1.0

4

dist/cjs/frenchkiss.js
/**
* @license frenchkiss 0.0.10
* @license frenchkiss 0.1.0
* Copyright (c) 2018-2019 Koala Interactive, Inc.
* License: MIT
*/
"use strict";var n=/^\s*\w+\s*$/,t=/^\s*(\w+)\s*,\s*(select|plural)\s*,/i,r=JSON.stringify,e=function(n){return'(p["'+n+'"]||(p["'+n+'"]=="0"?0:"'+n+'" in p?"":v("'+n+'",k,l)))'};function u(n){for(var t={},u=function n(t,u){var i=[];var o=t.length;for(var f=0;f<o;++f){var s=t[f],a=s[0],c=s[1],l="";if(0===a&&c)l=r(c);else if(1===a)l=e(c.trim());else if(2===a){for(var v=s[2],p=s[3],h=s[4],g=p.length,d=0;d<g;++d)h?"="===p[d][0][0]?l+='p["'+v+'"]=='+r(p[d][0].substr(1)):(u[v]=1,l+='m["'+v+'"]=='+r(p[d][0])):l+='p["'+v+'"]=='+r(p[d][0]),l+="?"+n(p[d][1],u)+":";l="("+l+n(c,u)+")"}l&&i.push(l)}return i.join("+")||'""'}(i(n),t),o=Object.keys(t),f=o.length,s=[],a=0;a<f;++a)s[a]=o[a]+':f(p["'+o[a]+'"])';return Function("a","f","k","l","v","var p=a||{}"+(f?",m=f?{"+s+"}:{}":"")+";return "+u)}function i(r){for(var e=0,u="",i=r.length,f=[],s=0;s<i;++s){var a=r[s],c=void 0;"{"===a?e++||(c=[0,u]):"}"===a&&(--e||(c=n.test(u)?[1,u]:t.test(u)?o(u):[0,u])),c?(f.push(c),u=""):u+=a}return f.push([0,u]),f}function o(n){for(var r=n.match(t),e=r[1],u="p"===r[2][0].toLowerCase(),o=i(n.replace(t,"")),f=o.length,s=[],a=[0,""],c=0;c<f-1;){var l=o[c++][1].trim(),v=i(o[c++][1]);"other"===l?a=v:u&&"="===l[0]?s.unshift([l,v]):s.push([l,v])}return[2,a,e,s,u]}var f={},s={},a={},c="",l="",v=function(n){return n},p=function(){return""},h=function(n,t){return f[t]&&f[t][n]||s[t]&&"string"==typeof s[t][n]&&(f[t][n]=u(s[t][n]))},g={cache:f,store:s,t:function(n,t,r){var e,u=r||c;return u&&(e=h(n,u))?e(t,a[u],n,u,p):(u=l)&&(e=h(n,u))?e(t,a[u],n,u,p):v(n)},onMissingKey:function(n){v=n},onMissingVariable:function(n){p=n},locale:function(n){return n&&(c=n),c},fallback:function(n){return n&&(l=n),l},set:function(n,t){f[n]={},s[n]=t},unset:function(n){delete f[n],delete s[n]},extend:function(n,t){s[n]||(s[n]={}),f[n]||(f[n]={});for(var r=Object.keys(t),e=r.length,u=0;u<e;++u){var i=r[u];s[n][i]=t[i],delete f[n][i]}},plural:function(n,t){a[n]=t}};module.exports=g;
"use strict";var t=/^\s*\w+\s*$/,e=/^\s*(\w+)\s*,\s*(select|plural)\s*,/i,n=JSON.stringify,r=function(t){return'(p["'+t+'"]||(p["'+t+'"]=="0"?0:"'+t+'" in p?"":v("'+t+'",k,l)))'};function u(t){for(var e={},u=function t(e,u){var o=[];var f=e.length;for(var i=0;i<f;++i){var s=e[i],l=s[0],a=s[1],c="";if(0===l&&a)c=n(a);else if(1===l)c=r(a.trim());else if(2===l){for(var p=s[2],v=s[3],h=s[4],g=v.length,y=0;y<g;++y)h?"="===v[y][0][0]?c+='p["'+p+'"]=='+n(v[y][0].substr(1)):(u[p]=1,c+='m["'+p+'"]=='+n(v[y][0])):c+='p["'+p+'"]=='+n(v[y][0]),c+="?"+t(v[y][1],u)+":";c="("+c+t(a,u)+")"}c&&o.push(c)}return o.join("+")||'""'}(o(t),e),f=Object.keys(e),i=f.length,s=[],l=0;l<i;++l)s[l]=f[l]+':f(p["'+f[l]+'"])';return Function("a","f","k","l","v","var p=a||{}"+(i?",m=f?{"+s+"}:{}":"")+";return "+u)}function o(n){for(var r=0,u="",o=n.length,i=[],s=0;s<o;++s){var l=n[s],a=void 0;"{"===l?r++||(a=[0,u]):"}"===l&&(--r||(a=t.test(u)?[1,u]:e.test(u)?f(u):[0,u])),a?(i.push(a),u=""):u+=l}return i.push([0,u]),i}function f(t){for(var n=t.match(e),r=n[1],u="p"===n[2][0].toLowerCase(),f=o(t.replace(e,"")),i=f.length,s=[],l=[0,""],a=0;a<i-1;){var c=f[a++][1].trim(),p=o(f[a++][1]);"other"===c?l=p:u&&"="===c[0]?s.unshift([c,p]):s.push([c,p])}return[2,l,r,s,u]}var i={},s={},l={},a="",c="",p=function(t){return t},v=function(){return""},h=function(t,e){return i[e]&&i[e][t]||g(t,e)},g=function(t,e){var n=s[e];if(n){if("string"==typeof n[t])n=n[t];else for(var r=t.split("."),o=r.length,f=0;f<o;++f){if(!n.hasOwnProperty(r[f]))return null;n=n[r[f]]}if("string"==typeof n)return i[e][t]=u(n)}return null},y=function t(e,n,r,u){for(var o=Object.keys(n),f=o.length,i=0;i<f;++i){var s=o[i],l=u?u+"."+s:s;if("object"==typeof n[s])"object"!=typeof e[s]&&(e[s]={}),t(e[s],n[s],r,l);else{if(delete r[l],"object"==typeof e[s])for(var a=l+".",c=a.length,p=Object.keys(r),v=p.length,h=0;h<v;++h){var g=p[h];g.substr(0,c)===a&&delete r[g]}e[s]=n[s]}}},b={cache:i,store:s,t:function(t,e,n){var r,u=n||a;return u&&(r=h(t,u))?r(e,l[u],t,u,v):(u=c)&&(r=h(t,u))?r(e,l[u],t,u,v):p(t)},onMissingKey:function(t){p=t},onMissingVariable:function(t){v=t},locale:function(t){return t&&(a=t),a},fallback:function(t){return t&&(c=t),c},set:function(t,e){i[t]={},s[t]=e},unset:function(t){delete i[t],delete s[t]},extend:function(t,e){s[t]||(s[t]={}),i[t]||(i[t]={}),y(s[t],e,i[t],"")},plural:function(t,e){l[t]=e}};module.exports=b;
/**
* @license frenchkiss 0.0.10
* @license frenchkiss 0.1.0
* Copyright (c) 2018-2019 Koala Interactive, Inc.
* License: MIT
*/
const t=/^\s*\w+\s*$/,e=/^\s*(\w+)\s*,\s*(select|plural)\s*,/i,n=JSON.stringify,s=t=>'(p["'+t+'"]||(p["'+t+'"]=="0"?0:"'+t+'" in p?"":v("'+t+'",k,l)))';function l(t){const e={},l=function t(e,l){const o=[];const r=e.length;for(let c=0;c<r;++c){const r=e[c],i=r[0],f=r[1];let u="";if(0===i&&f)u=n(f);else if(1===i)u=s(f.trim());else if(2===i){const e=r[2],s=r[3],o=r[4],c=s.length;for(let r=0;r<c;++r)o?"="===s[r][0][0]?u+='p["'+e+'"]=='+n(s[r][0].substr(1)):(l[e]=1,u+='m["'+e+'"]=='+n(s[r][0])):u+='p["'+e+'"]=='+n(s[r][0]),u+="?"+t(s[r][1],l)+":";u="("+u+t(f,l)+")"}u&&o.push(u)}return o.join("+")||'""'}(o(t),e),r=Object.keys(e),c=r.length,i=[];for(let t=0;t<c;++t)i[t]=r[t]+':f(p["'+r[t]+'"])';return Function("a","f","k","l","v","var p=a||{}"+(c?",m=f?{"+i+"}:{}":"")+";return "+l)}function o(n){let s=0,l="";const o=n.length,c=[];for(let i=0;i<o;++i){const o=n[i];let f;"{"===o?s++||(f=[0,l]):"}"===o&&(--s||(f=t.test(l)?[1,l]:e.test(l)?r(l):[0,l])),f?(c.push(f),l=""):l+=o}return c.push([0,l]),c}function r(t){const n=t.match(e),s=n[1],l="p"===n[2][0].toLowerCase(),r=o(t.replace(e,"")),c=r.length,i=[];let f=[0,""];for(let t=0;t<c-1;){let e=r[t++][1].trim();const n=o(r[t++][1]);"other"===e?f=n:l&&"="===e[0]?i.unshift([e,n]):i.push([e,n])}return[2,f,s,i,l]}const c={},i={};let f={},u="",p="",a=t=>t,h=()=>"";const g=(t,e)=>c[e]&&c[e][t]||i[e]&&"string"==typeof i[e][t]&&(c[e][t]=l(i[e][t])),b=(t,e,n)=>{let s,l=n||u;return l&&(s=g(t,l))?s(e,f[l],t,l,h):(l=p)&&(s=g(t,l))?s(e,f[l],t,l,h):a(t)},d=t=>{a=t},k=t=>{h=t},m=t=>(t&&(u=t),u),y=t=>(t&&(p=t),p),j=(t,e)=>{c[t]={},i[t]=e},v=(t,e)=>{f[t]=e},w=(t,e)=>{i[t]||(i[t]={}),c[t]||(c[t]={});const n=Object.keys(e),s=n.length;for(let l=0;l<s;++l){const s=n[l];i[t][s]=e[s],delete c[t][s]}},x=t=>{delete c[t],delete i[t]};export default{cache:c,store:i,t:b,onMissingKey:d,onMissingVariable:k,locale:m,fallback:y,set:j,unset:x,extend:w,plural:v};export{c as cache,i as store,b as t,d as onMissingKey,k as onMissingVariable,m as locale,y as fallback,j as set,v as plural,w as extend,x as unset};
const t=/^\s*\w+\s*$/,e=/^\s*(\w+)\s*,\s*(select|plural)\s*,/i,n=JSON.stringify,s=t=>'(p["'+t+'"]||(p["'+t+'"]=="0"?0:"'+t+'" in p?"":v("'+t+'",k,l)))';function l(t){const e={},l=function t(e,l){const o=[];const r=e.length;for(let c=0;c<r;++c){const r=e[c],f=r[0],i=r[1];let u="";if(0===f&&i)u=n(i);else if(1===f)u=s(i.trim());else if(2===f){const e=r[2],s=r[3],o=r[4],c=s.length;for(let r=0;r<c;++r)o?"="===s[r][0][0]?u+='p["'+e+'"]=='+n(s[r][0].substr(1)):(l[e]=1,u+='m["'+e+'"]=='+n(s[r][0])):u+='p["'+e+'"]=='+n(s[r][0]),u+="?"+t(s[r][1],l)+":";u="("+u+t(i,l)+")"}u&&o.push(u)}return o.join("+")||'""'}(o(t),e),r=Object.keys(e),c=r.length,f=[];for(let t=0;t<c;++t)f[t]=r[t]+':f(p["'+r[t]+'"])';return Function("a","f","k","l","v","var p=a||{}"+(c?",m=f?{"+f+"}:{}":"")+";return "+l)}function o(n){let s=0,l="";const o=n.length,c=[];for(let f=0;f<o;++f){const o=n[f];let i;"{"===o?s++||(i=[0,l]):"}"===o&&(--s||(i=t.test(l)?[1,l]:e.test(l)?r(l):[0,l])),i?(c.push(i),l=""):l+=o}return c.push([0,l]),c}function r(t){const n=t.match(e),s=n[1],l="p"===n[2][0].toLowerCase(),r=o(t.replace(e,"")),c=r.length,f=[];let i=[0,""];for(let t=0;t<c-1;){let e=r[t++][1].trim();const n=o(r[t++][1]);"other"===e?i=n:l&&"="===e[0]?f.unshift([e,n]):f.push([e,n])}return[2,i,s,f,l]}const c={},f={};let i={},u="",p="",h=t=>t,a=()=>"";const g=(t,e)=>c[e]&&c[e][t]||y(t,e),y=(t,e)=>{let n=f[e];if(n){if("string"==typeof n[t])n=n[t];else{const e=t.split("."),s=e.length;for(let t=0;t<s;++t){if(!n.hasOwnProperty(e[t]))return null;n=n[e[t]]}}if("string"==typeof n)return c[e][t]=l(n)}return null},b=(t,e,n)=>{let s,l=n||u;return l&&(s=g(t,l))?s(e,i[l],t,l,a):(l=p)&&(s=g(t,l))?s(e,i[l],t,l,a):h(t)},j=t=>{h=t},d=t=>{a=t},k=t=>(t&&(u=t),u),m=t=>(t&&(p=t),p),O=(t,e)=>{c[t]={},f[t]=e},w=(t,e)=>{i[t]=e},v=(t,e)=>{f[t]||(f[t]={}),c[t]||(c[t]={}),x(f[t],e,c[t],"")},x=(t,e,n,s)=>{const l=Object.keys(e),o=l.length;for(let r=0;r<o;++r){const o=l[r],c=s?s+"."+o:o;if("object"==typeof e[o])"object"!=typeof t[o]&&(t[o]={}),x(t[o],e[o],n,c);else{if(delete n[c],"object"==typeof t[o]){const t=c+".",e=t.length,s=Object.keys(n),l=s.length;for(let o=0;o<l;++o){const l=s[o];l.substr(0,e)===t&&delete n[l]}}t[o]=e[o]}}},M=t=>{delete c[t],delete f[t]};export default{cache:c,store:f,t:b,onMissingKey:j,onMissingVariable:d,locale:k,fallback:m,set:O,unset:M,extend:v,plural:w};export{c as cache,f as store,b as t,j as onMissingKey,d as onMissingVariable,k as locale,m as fallback,O as set,w as plural,v as extend,M as unset};
/**
* @license frenchkiss 0.0.10
* @license frenchkiss 0.1.0
* Copyright (c) 2018-2019 Koala Interactive, Inc.
* License: MIT
*/
var n,e;n=this,e=function(){"use strict";var n=/^\s*\w+\s*$/,e=/^\s*(\w+)\s*,\s*(select|plural)\s*,/i,t=JSON.stringify,r=function(n){return'(p["'+n+'"]||(p["'+n+'"]=="0"?0:"'+n+'" in p?"":v("'+n+'",k,l)))'};function u(n){for(var e={},u=function n(e,u){var i=[];var f=e.length;for(var o=0;o<f;++o){var s=e[o],c=s[0],a=s[1],l="";if(0===c&&a)l=t(a);else if(1===c)l=r(a.trim());else if(2===c){for(var p=s[2],v=s[3],h=s[4],d=v.length,g=0;g<d;++g)h?"="===v[g][0][0]?l+='p["'+p+'"]=='+t(v[g][0].substr(1)):(u[p]=1,l+='m["'+p+'"]=='+t(v[g][0])):l+='p["'+p+'"]=='+t(v[g][0]),l+="?"+n(v[g][1],u)+":";l="("+l+n(a,u)+")"}l&&i.push(l)}return i.join("+")||'""'}(i(n),e),f=Object.keys(e),o=f.length,s=[],c=0;c<o;++c)s[c]=f[c]+':f(p["'+f[c]+'"])';return Function("a","f","k","l","v","var p=a||{}"+(o?",m=f?{"+s+"}:{}":"")+";return "+u)}function i(t){for(var r=0,u="",i=t.length,o=[],s=0;s<i;++s){var c=t[s],a=void 0;"{"===c?r++||(a=[0,u]):"}"===c&&(--r||(a=n.test(u)?[1,u]:e.test(u)?f(u):[0,u])),a?(o.push(a),u=""):u+=c}return o.push([0,u]),o}function f(n){for(var t=n.match(e),r=t[1],u="p"===t[2][0].toLowerCase(),f=i(n.replace(e,"")),o=f.length,s=[],c=[0,""],a=0;a<o-1;){var l=f[a++][1].trim(),p=i(f[a++][1]);"other"===l?c=p:u&&"="===l[0]?s.unshift([l,p]):s.push([l,p])}return[2,c,r,s,u]}var o={},s={},c={},a="",l="",p=function(n){return n},v=function(){return""},h=function(n,e){return o[e]&&o[e][n]||s[e]&&"string"==typeof s[e][n]&&(o[e][n]=u(s[e][n]))};return{cache:o,store:s,t:function(n,e,t){var r,u=t||a;return u&&(r=h(n,u))?r(e,c[u],n,u,v):(u=l)&&(r=h(n,u))?r(e,c[u],n,u,v):p(n)},onMissingKey:function(n){p=n},onMissingVariable:function(n){v=n},locale:function(n){return n&&(a=n),a},fallback:function(n){return n&&(l=n),l},set:function(n,e){o[n]={},s[n]=e},unset:function(n){delete o[n],delete s[n]},extend:function(n,e){s[n]||(s[n]={}),o[n]||(o[n]={});for(var t=Object.keys(e),r=t.length,u=0;u<r;++u){var i=t[u];s[n][i]=e[i],delete o[n][i]}},plural:function(n,e){c[n]=e}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).frenchkiss=e();
var e,t;e=this,t=function(){"use strict";var e=/^\s*\w+\s*$/,t=/^\s*(\w+)\s*,\s*(select|plural)\s*,/i,n=JSON.stringify,r=function(e){return'(p["'+e+'"]||(p["'+e+'"]=="0"?0:"'+e+'" in p?"":v("'+e+'",k,l)))'};function f(e){for(var t={},f=function e(t,f){var o=[];var i=t.length;for(var u=0;u<i;++u){var s=t[u],c=s[0],l=s[1],a="";if(0===c&&l)a=n(l);else if(1===c)a=r(l.trim());else if(2===c){for(var p=s[2],v=s[3],h=s[4],d=v.length,g=0;g<d;++g)h?"="===v[g][0][0]?a+='p["'+p+'"]=='+n(v[g][0].substr(1)):(f[p]=1,a+='m["'+p+'"]=='+n(v[g][0])):a+='p["'+p+'"]=='+n(v[g][0]),a+="?"+e(v[g][1],f)+":";a="("+a+e(l,f)+")"}a&&o.push(a)}return o.join("+")||'""'}(o(e),t),i=Object.keys(t),u=i.length,s=[],c=0;c<u;++c)s[c]=i[c]+':f(p["'+i[c]+'"])';return Function("a","f","k","l","v","var p=a||{}"+(u?",m=f?{"+s+"}:{}":"")+";return "+f)}function o(n){for(var r=0,f="",o=n.length,u=[],s=0;s<o;++s){var c=n[s],l=void 0;"{"===c?r++||(l=[0,f]):"}"===c&&(--r||(l=e.test(f)?[1,f]:t.test(f)?i(f):[0,f])),l?(u.push(l),f=""):f+=c}return u.push([0,f]),u}function i(e){for(var n=e.match(t),r=n[1],f="p"===n[2][0].toLowerCase(),i=o(e.replace(t,"")),u=i.length,s=[],c=[0,""],l=0;l<u-1;){var a=i[l++][1].trim(),p=o(i[l++][1]);"other"===a?c=p:f&&"="===a[0]?s.unshift([a,p]):s.push([a,p])}return[2,c,r,s,f]}var u={},s={},c={},l="",a="",p=function(e){return e},v=function(){return""},h=function(e,t){return u[t]&&u[t][e]||d(e,t)},d=function(e,t){var n=s[t];if(n){if("string"==typeof n[e])n=n[e];else for(var r=e.split("."),o=r.length,i=0;i<o;++i){if(!n.hasOwnProperty(r[i]))return null;n=n[r[i]]}if("string"==typeof n)return u[t][e]=f(n)}return null},g=function e(t,n,r,f){for(var o=Object.keys(n),i=o.length,u=0;u<i;++u){var s=o[u],c=f?f+"."+s:s;if("object"==typeof n[s])"object"!=typeof t[s]&&(t[s]={}),e(t[s],n[s],r,c);else{if(delete r[c],"object"==typeof t[s])for(var l=c+".",a=l.length,p=Object.keys(r),v=p.length,h=0;h<v;++h){var d=p[h];d.substr(0,a)===l&&delete r[d]}t[s]=n[s]}}};return{cache:u,store:s,t:function(e,t,n){var r,f=n||l;return f&&(r=h(e,f))?r(t,c[f],e,f,v):(f=a)&&(r=h(e,f))?r(t,c[f],e,f,v):p(e)},onMissingKey:function(e){p=e},onMissingVariable:function(e){v=e},locale:function(e){return e&&(l=e),l},fallback:function(e){return e&&(a=e),a},set:function(e,t){u[e]={},s[e]=t},unset:function(e){delete u[e],delete s[e]},extend:function(e,t){s[e]||(s[e]={}),u[e]||(u[e]={}),g(s[e],t,u[e],"")},plural:function(e,t){c[e]=t}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).frenchkiss=t();

@@ -11,3 +11,3 @@ declare module 'frenchkiss' {

interface StoreData {
[key: string]: string | number;
[key: string]: string | number | StoreData;
}

@@ -25,6 +25,2 @@

interface StoreItems {
[key: string]: StoreData;
}
interface CacheItems {

@@ -35,3 +31,3 @@ [key: string]: CacheData;

export const cache: CacheItems;
export const store: StoreItems;
export const store: StoreData;
export function t(key: string, params?: object, language?: string): string;

@@ -38,0 +34,0 @@ export function onMissingKey(

{
"name": "frenchkiss",
"version": "0.0.11",
"version": "0.1.0",
"description": "The blazing fast lightweight translation module for javascript",

@@ -5,0 +5,0 @@ "author": "Vincent Thibault <vthibault.mobile@gmail.com>",

@@ -5,3 +5,3 @@ <div align="center">

[![Build Status](https://travis-ci.com/koala-interactive/frenchkiss.js.svg?branch=master)](https://travis-ci.com/koala-interactive/frenchkiss.js)
[![File size](https://img.shields.io/badge/GZIP%20size-1076%20B-brightgreen.svg)](./dist/umd/frenchkiss.js)
[![File size](https://img.shields.io/badge/GZIP%20size-1.2%20kB-brightgreen.svg)](./dist/umd/frenchkiss.js)
![](https://img.shields.io/badge/dependencies-none-brightgreen.svg)

@@ -66,2 +66,3 @@ ![](https://img.shields.io/snyk/vulnerabilities/github/koala-interactive/frenchkiss.js.svg)

- [frenchkiss.onMissingVariable()](#frenchkissonMissingVariablefn-Function)
- [Nested keys](#nested-keys)
- [SELECT expression](#select-expression)

@@ -85,3 +86,5 @@ - [PLURAL expression](#plural-expression)

hello: 'Hello {name} !',
goodbye: 'Bye !',
fruits: {
apple: 'apples'
},
// and other sentences...

@@ -93,2 +96,4 @@ });

}); // => 'Hello John !'
frenchkiss.t('fruits.apple'); // => 'apples'
```

@@ -130,3 +135,3 @@

- ✅ It supports nested `PLURAL`, `SELECT` and `variables`.
- ❌ It does not support nested keys _(to keep it fast)_.
- ✅ It supports nested keys (using dots in keys).
- ❌ It does not support date, number, currency formatting (maybe check for [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/NumberFormat) and [Intl.DateTimeFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/DateTimeFormat)).

@@ -253,2 +258,50 @@

### Nested keys
Under the hood, frenchkiss allows you to handle nested keys, by using `'.'` inside key names.
```js
frenchkiss.set('en', {
fruits: {
apple: 'An apple',
banana: 'A banana'
},
vegetables: {
carrot: 'A carrot',
daikon: 'A daikon'
}
});
frenchkiss.t('fruits.apple') // => 'An apple'
```
Accessing an object directly will result on the `onMissingKey` method to be called:
```js
frenchkiss.set('en', {
fruits: {
apple: 'An apple',
banana: 'A banana'
}
});
frenchkiss.onMissingKey(key => `[notfound:${key}]`);
frenchkiss.t('fruits'); // => '[notfound:fruits]'
```
In case of duplicate names on key and objects, the result will always prioritize the key value.
```js
frenchkiss.set('en', {
'fruits.apple': '(linear) apple'
fruits: {
apple: '(nested) apple'
}
});
frenchkiss.t('fruits.apple'); // => '(linear) apple'
```
---
### SELECT expression

@@ -255,0 +308,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc